import React, { useState, InputHTMLAttributes } from "react"; interface FormFieldProps extends InputHTMLAttributes { title: string; placeholder?: string; value: string; handleChangeText: (value: string) => void; } const FormField = ({ title, placeholder, value, handleChangeText, ...props }: FormFieldProps) => { const [showPassword, setShowPassword] = useState(false); const isPasswordField = title.toLowerCase().includes("password"); const inputId = `input-${title.replace(/\s+/g, "-").toLowerCase()}`; return ( {title} handleChangeText(e.target.value)} className="flex-1 bg-transparent outline-none border-none text-blue-950 text-[16px] font-inherit" {...props} /> {isPasswordField && ( setShowPassword((prev) => !prev)} aria-label={showPassword ? "Hide password" : "Show password"} className="ml-2 text-gray-600 hover:text-gray-800 focus:outline-none font-montserrat font-medium text-[16px] bg-none border-none" > {showPassword ? "Hide" : "Show"} )} ); }; export default FormField;