From 771889ab4f376ecf7bd3cdfbcc3227830987f824 Mon Sep 17 00:00:00 2001 From: Michael Chihlas Date: Sat, 14 Feb 2026 23:22:19 -0500 Subject: [PATCH] feat: add reusable PasswordInput with show/hide toggle Replaces all type="password" inputs site-wide with a PasswordInput component that includes an eye icon toggle for visibility. Co-Authored-By: Claude Opus 4.6 --- .../src/components/common/PasswordInput.tsx | 32 +++++++++++++++++++ .../components/procedural/IntakeFormModal.tsx | 4 +-- frontend/src/pages/ChangePasswordPage.tsx | 10 +++--- frontend/src/pages/LoginPage.tsx | 4 +-- frontend/src/pages/RegisterPage.tsx | 7 ++-- frontend/src/pages/ResetPasswordPage.tsx | 7 ++-- 6 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 frontend/src/components/common/PasswordInput.tsx diff --git a/frontend/src/components/common/PasswordInput.tsx b/frontend/src/components/common/PasswordInput.tsx new file mode 100644 index 00000000..d061f291 --- /dev/null +++ b/frontend/src/components/common/PasswordInput.tsx @@ -0,0 +1,32 @@ +import { useState } from 'react' +import { Eye, EyeOff } from 'lucide-react' +import { cn } from '@/lib/utils' + +interface PasswordInputProps extends Omit, 'type'> { + className?: string +} + +export function PasswordInput({ className, ...props }: PasswordInputProps) { + const [visible, setVisible] = useState(false) + + return ( +
+ + +
+ ) +} + +export default PasswordInput diff --git a/frontend/src/components/procedural/IntakeFormModal.tsx b/frontend/src/components/procedural/IntakeFormModal.tsx index 148e895e..b295624b 100644 --- a/frontend/src/components/procedural/IntakeFormModal.tsx +++ b/frontend/src/components/procedural/IntakeFormModal.tsx @@ -1,5 +1,6 @@ import { useState } from 'react' import type { IntakeFormField } from '@/types' +import { PasswordInput } from '@/components/common/PasswordInput' import { cn } from '@/lib/utils' interface IntakeFormModalProps { @@ -119,8 +120,7 @@ export function IntakeFormModal({ isOpen, fields, treeName, onSubmit, onCancel } case 'password': input = ( - setValue(field.variable_name, e.target.value)} placeholder={field.placeholder} diff --git a/frontend/src/pages/ChangePasswordPage.tsx b/frontend/src/pages/ChangePasswordPage.tsx index 34b1e1d0..9dda8f43 100644 --- a/frontend/src/pages/ChangePasswordPage.tsx +++ b/frontend/src/pages/ChangePasswordPage.tsx @@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom' import { useAuthStore } from '@/store/authStore' import { authApi } from '@/api/auth' import { toast } from '@/lib/toast' +import { PasswordInput } from '@/components/common/PasswordInput' import { BrandLogo } from '@/components/common/BrandLogo' import { cn } from '@/lib/utils' @@ -87,9 +88,8 @@ export function ChangePasswordPage() { - New Password - Confirm New Password - Password - Password - Confirm password - New Password - Confirm New Password -