Skip to content

Commit 4533f6a

Browse files
YuvalYuval
authored andcommitted
feat(LoginScreen): add password visibility toggle and EyeIcon component
1 parent 60e3532 commit 4533f6a

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

03-Client/src/app/components/LoginScreen.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,29 @@ import { BackgroundDecorations } from "./shared/BackgroundDecorations";
55
import { SocialLoginButtons } from "./shared/SocialLoginButtons";
66
import { useAuth } from "../context/AuthContext";
77

8+
function EyeIcon({ open }: { open: boolean }) {
9+
if (open) {
10+
return (
11+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#626262" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
12+
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" />
13+
<circle cx="12" cy="12" r="3" />
14+
</svg>
15+
);
16+
}
17+
return (
18+
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#626262" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
19+
<path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24" />
20+
<line x1="1" y1="1" x2="23" y2="23" />
21+
</svg>
22+
);
23+
}
24+
825
export function LoginScreen() {
926
const navigate = useNavigate();
1027
const { login } = useAuth();
1128
const [email, setEmail] = useState("");
1229
const [password, setPassword] = useState("");
30+
const [showPassword, setShowPassword] = useState(false);
1331
const [error, setError] = useState("");
1432
const [loading, setLoading] = useState(false);
1533

@@ -66,14 +84,22 @@ export function LoginScreen() {
6684
</div>
6785
<div className="relative">
6886
<input
69-
type="password"
87+
type={showPassword ? "text" : "password"}
7088
value={password}
7189
onChange={(e) => setPassword(e.target.value)}
7290
placeholder="סיסמא"
7391
dir="rtl"
7492
// Added: hover:border-[#063c55] focus:border-[#063c55] transition-colors duration-200
7593
className="w-full bg-[#f3fbfd] border-2 border-transparent hover:border-[#063c55] focus:border-[#063c55] transition-colors duration-200 rounded-[10px] py-[18px] px-[35px] text-right font-['Heebo',sans-serif] text-[#626262] text-[16px] outline-none shadow-[inset_4px_14px_16.2px_0px_rgba(0,0,0,0.04)]"
7694
/>
95+
<button
96+
type="button"
97+
onClick={() => setShowPassword((v) => !v)}
98+
className="absolute left-[12px] top-1/2 -translate-y-1/2 p-[4px] cursor-pointer"
99+
tabIndex={-1}
100+
>
101+
<EyeIcon open={showPassword} />
102+
</button>
77103
</div>
78104
</div>
79105

0 commit comments

Comments
 (0)