This commit is contained in:
Hunter Thornsberry
2024-10-02 22:07:45 -04:00
parent 8549d56c21
commit d699764546
3 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -31,7 +31,7 @@ export function GenericInput<T extends FieldValues>({
}: GenericFormElementProps<T, InputFieldProps<T>>) {
const [passwordShown, setPasswordShown] = useState(false);
const togglePasswordVisiblity = () => {
setPasswordShown(passwordShown ? false : true);
setPasswordShown(!passwordShown);
};
return (
@@ -40,9 +40,11 @@ export function GenericInput<T extends FieldValues>({
control={control}
render={({ field: { value, onChange, ...rest } }) => (
<Input
type={field.type == "password" && passwordShown ? "text" : field.type}
type={
field.type === "password" && passwordShown ? "text" : field.type
}
action={
field.type == "password"
field.type === "password"
? {
icon: passwordShown ? EyeOff : Eye,
onClick: togglePasswordVisiblity,