This is just a technology testing project based on Create React App and TailwindCSS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1.0KB

  1. import React from 'react'
  2. import { Field, ErrorMessage } from 'formik'
  3. import FormikControlErrorMessage from '../FormikControlErrorMessage'
  4. import newId from '../../../utils/newId';
  5. function FormikControlPassword(props) {
  6. const { label, name, ...rest } = props
  7. const htmlId = newId()
  8. return (
  9. <div className="mt-4 mb-2">
  10. <label htmlFor={htmlId} className="form-control block text-lg text-gray-800 py-1">
  11. <span className="text-gray-700 ml-1">{label}</span>
  12. </label>
  13. <Field
  14. type="password"
  15. label={label}
  16. title={label}
  17. id={htmlId}
  18. name={name}
  19. aria-describedby={name + 'Error'}
  20. {...rest}
  21. className="form-input mt-1 block w-full text-center tracking-widest"
  22. />
  23. <ErrorMessage component={FormikControlErrorMessage} name={name} label={label} id={name + 'Error'} />
  24. </div>
  25. )
  26. }
  27. export default FormikControlPassword