@@ -16,6 +16,7 @@ export default function LoginPage() {
1616 const [ password , setPassword ] = useState ( "" ) ;
1717 const [ error , setError ] = useState < string | null > ( null ) ;
1818 const [ loading , setLoading ] = useState ( false ) ;
19+ const [ showPassword , setShowPassword ] = useState ( false ) ;
1920
2021 const handleSubmit = async ( e : React . FormEvent ) => {
2122 e . preventDefault ( ) ;
@@ -57,13 +58,32 @@ export default function LoginPage() {
5758 </ div >
5859 < div >
5960 < label className = "block text-sm mb-1" > Password</ label >
60- < input
61- className = "w-full px-3 py-2 rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"
62- type = "password"
63- value = { password }
64- onChange = { ( e ) => setPassword ( e . target . value ) }
65- required
66- />
61+ < div className = "relative" >
62+ < input
63+ className = "w-full px-3 py-2 pr-10 rounded-md border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900"
64+ type = { showPassword ? "text" : "password" }
65+ value = { password }
66+ onChange = { ( e ) => setPassword ( e . target . value ) }
67+ required
68+ />
69+ < button
70+ type = "button"
71+ onClick = { ( ) => setShowPassword ( ( v ) => ! v ) }
72+ className = "absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-200 transition-colors"
73+ aria-label = { showPassword ? "Hide password" : "Show password" }
74+ >
75+ { showPassword ? (
76+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
77+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21" />
78+ </ svg >
79+ ) : (
80+ < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
81+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
82+ < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
83+ </ svg >
84+ ) }
85+ </ button >
86+ </ div >
6787 </ div >
6888 < button
6989 type = "submit"
0 commit comments