({ label, name, ...rest }: AuthInputProps)
| 6 | } |
| 7 | |
| 8 | const AuthInput = ({ label, name, ...rest }: AuthInputProps) => { |
| 9 | const { |
| 10 | register, |
| 11 | formState: { errors }, |
| 12 | } = useFormContext(); |
| 13 | |
| 14 | const error = errors[name]; |
| 15 | |
| 16 | return ( |
| 17 | <div> |
| 18 | <label |
| 19 | htmlFor={label} |
| 20 | className="mb-2 block text-sm font-medium text-gray-900 dark:text-white" |
| 21 | > |
| 22 | {label} |
| 23 | </label> |
| 24 | <input |
| 25 | {...register(name)} |
| 26 | {...rest} |
| 27 | className={ |
| 28 | "block w-full rounded-md border-0 py-1.5 text-sm leading-6 text-gray-900 ring-1 ring-inset ring-gray-300 transition-all placeholder:text-gray-400 focus:outline focus:outline-[3px] focus:outline-blue-200 focus:ring-2 focus:ring-blue-400" |
| 29 | } |
| 30 | /> |
| 31 | {error && ( |
| 32 | <p className="mt-2 text-xs text-red-500">{error.message?.toString()}</p> |
| 33 | )} |
| 34 | </div> |
| 35 | ); |
| 36 | }; |
| 37 | |
| 38 | export default AuthInput; |
nothing calls this directly
no outgoing calls
no test coverage detected