import {Eye, EyeOff} from "lucide-react"; import {useState} from "react"; import {defaultIconSize} from "./SvgIcon"; import clsx from "clsx"; type PasswordFieldProps = { onPasswordChanged: (password: string) => void onKeyDown: (event: React.KeyboardEvent) => void className?: string } /** * Password field component */ export default function PasswordField({onPasswordChanged, onKeyDown, className = ""}: PasswordFieldProps) { const [showPassword, setShowPassword] = useState(false); const [password, setPassword] = useState(""); const changePassword = (password: string) => { setPassword(password); onPasswordChanged(password) } return (
changePassword(e.target.value)} onKeyDown={onKeyDown} /> {/* Add a little eye icon to the right for showing password */}
); }