| 4 | import {cn} from "@/lib/utils"; |
| 5 | |
| 6 | const InputField = ({name, label, placeholder, type ="text", register, error, validation, disabled, value}: FormInputProps) => { |
| 7 | return ( |
| 8 | <div className="space-y-2"> |
| 9 | <Label htmlFor={name} className="form-label"> |
| 10 | {label} |
| 11 | </Label> |
| 12 | <Input |
| 13 | type={type} |
| 14 | id={name} |
| 15 | placeholder={placeholder} |
| 16 | disabled={disabled} |
| 17 | value={value} |
| 18 | className={cn('form-input', {'opacity-50 cursor-not-allowed': disabled})} |
| 19 | {...register(name, validation)} |
| 20 | /> |
| 21 | {error && <p className="text-red-500">{error.message}</p>} |
| 22 | </div> |
| 23 | ) |
| 24 | } |
| 25 | export default InputField |