From 2ba01164ff3c06fe6c12cbd73bc460d0b9f80f3e Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 14 Apr 2026 14:04:17 +0200 Subject: [PATCH] =?UTF-8?q?add:=20a=C3=B1adir=20componente=20para=20icono?= =?UTF-8?q?=20de=20ojo=20abierto/cerrado=20para=20ver/ocultar=20la=20contr?= =?UTF-8?q?ase=C3=B1a=20en=20el=20input=20de=20login/registro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/EyeIcon.jsx | 12 ++++++ frontend/src/pages/Login.jsx | 28 ++++++++++---- frontend/src/pages/Register.jsx | 59 +++++++++++++++++++---------- 3 files changed, 71 insertions(+), 28 deletions(-) create mode 100644 frontend/src/components/EyeIcon.jsx diff --git a/frontend/src/components/EyeIcon.jsx b/frontend/src/components/EyeIcon.jsx new file mode 100644 index 0000000..70437ac --- /dev/null +++ b/frontend/src/components/EyeIcon.jsx @@ -0,0 +1,12 @@ +export default function EyeIcon({ isOpen }) { + return isOpen ? ( + + + + + ) : ( + + + + ); +} \ No newline at end of file diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx index 12b60c9..8f3ff7a 100644 --- a/frontend/src/pages/Login.jsx +++ b/frontend/src/pages/Login.jsx @@ -2,10 +2,12 @@ import { useState, useEffect, useRef } from 'react'; import { Link, useNavigate, useSearchParams } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { authService } from '../services/authService'; +import EyeIcon from '../components/EyeIcon'; export default function Login() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); + const [showPassword, setShowPassword] = useState(false); const [error, setError] = useState(''); const navigate = useNavigate(); @@ -72,8 +74,8 @@ export default function Login() {
-

Iniciar sesión

-

Únete para guardar tu progreso

+

Deck of Cards

+

Accede a tu historial y gráficas guardadas

{error && ( @@ -91,14 +93,26 @@ export default function Login() { placeholder="correo@ejemplo.com" />
+
- setPassword(e.target.value)} - className="w-full px-5 py-3 rounded-2xl border border-slate-200 focus:ring-2 focus:ring-blue-500 outline-none transition-all bg-slate-50 focus:bg-white" - placeholder="••••••••" - /> +
+ setPassword(e.target.value)} + className="w-full pl-5 pr-12 py-3 rounded-2xl border border-slate-200 focus:ring-2 focus:ring-blue-500 outline-none transition-all bg-slate-50 focus:bg-white" + placeholder="••••••••" + /> + +
+ diff --git a/frontend/src/pages/Register.jsx b/frontend/src/pages/Register.jsx index ad80d0c..cdc38fc 100644 --- a/frontend/src/pages/Register.jsx +++ b/frontend/src/pages/Register.jsx @@ -2,12 +2,17 @@ import { useState } from 'react'; import { useNavigate, Link } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; import { authService } from '../services/authService'; +import EyeIcon from '../components/EyeIcon'; export default function Register() { const [username, setUsername] = useState(''); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); + + const [showPassword, setShowPassword] = useState(false); + const [showConfirmPassword, setShowConfirmPassword] = useState(false); + const [error, setError] = useState(''); const navigate = useNavigate(); const { login } = useAuth(); @@ -23,13 +28,7 @@ export default function Register() { try { const data = await authService.register(username, email, password); - - const userData = { - id: data.user_id, - username: username, - email: email - }; - + const userData = { id: data.user_id, username: username, email: email }; login(userData, data.token); navigate('/'); } catch (err) { @@ -43,7 +42,7 @@ export default function Register() {

Crear Cuenta

-

Únete para guardar tu progreso

+

Inicia sesión para guardar tu progreso

{error && ( @@ -59,7 +58,7 @@ export default function Register() { type="text" required autoComplete="username" className="w-full px-5 py-3 rounded-2xl border border-slate-200 focus:ring-2 focus:ring-blue-500 outline-none transition-all bg-slate-50 focus:bg-white" value={username} onChange={(e) => setUsername(e.target.value)} - placeholder="Ej: usuario" + placeholder="Ej: usuario99" /> @@ -75,22 +74,40 @@ export default function Register() {
- setPassword(e.target.value)} - placeholder="••••••••" - /> +
+ setPassword(e.target.value)} + placeholder="••••••••" + /> + +
- setConfirmPassword(e.target.value)} - placeholder="••••••••" - /> +
+ setConfirmPassword(e.target.value)} + placeholder="••••••••" + /> + +