|
| 1 | +"use client"; |
| 2 | + |
| 3 | +import { Card, CardHeader, CardTitle, CardContent, CardFooter } from "@/components/home/ui/card"; |
| 4 | +import { Button } from "@/components/home/ui/button"; |
| 5 | +import { useState } from "react"; |
| 6 | +import Link from "next/link"; |
| 7 | + |
| 8 | +export default function SignUpPage() { |
| 9 | + const [nombre, setNombre] = useState(""); |
| 10 | + const [apellido, setApellido] = useState(""); |
| 11 | + const [email, setEmail] = useState(""); |
| 12 | + const [password, setPassword] = useState(""); |
| 13 | + const [loading, setLoading] = useState(false); |
| 14 | + const [error, setError] = useState(""); |
| 15 | + |
| 16 | + const handleSubmit = async (e: React.FormEvent) => { |
| 17 | + e.preventDefault(); |
| 18 | + setLoading(true); |
| 19 | + setError(""); |
| 20 | + // Lógica real de autenticación aquí |
| 21 | + |
| 22 | + // Simulación de una llamada a la API |
| 23 | + setTimeout(() => { |
| 24 | + setLoading(false); |
| 25 | + if (!nombre || !apellido || !email || !password) { |
| 26 | + setError("Por favor, completa todos los campos."); |
| 27 | + } else { |
| 28 | + // Simulación de éxito |
| 29 | + alert("¡Registro exitoso! Ahora puedes iniciar sesión."); |
| 30 | + window.location.href = "/" |
| 31 | + } |
| 32 | + }, 1200); |
| 33 | + }; |
| 34 | + |
| 35 | + return ( |
| 36 | + <div className="min-h-screen flex flex-col items-center justify-center bg-azul-niebla dark:bg-[#121212] p-4"> |
| 37 | + {/* Logo ACM */} |
| 38 | + <Link href="/" className="mb-6 flex flex-col items-center group select-none"> |
| 39 | + <img |
| 40 | + src="/Logo_Oscuro.svg" |
| 41 | + alt="Logo ACM Javeriana" |
| 42 | + className="h-16 w-auto dark:hidden drop-shadow-md transition-transform group-hover:scale-105" |
| 43 | + draggable={false} |
| 44 | + /> |
| 45 | + <img |
| 46 | + src="/Logo_Claro.svg" |
| 47 | + alt="Logo ACM Javeriana" |
| 48 | + className="h-16 w-auto hidden dark:flex drop-shadow-md transition-transform group-hover:scale-105" |
| 49 | + draggable={false} |
| 50 | + /> |
| 51 | + </Link> |
| 52 | + <Card className="w-full max-w-md shadow-lg"> |
| 53 | + <CardHeader> |
| 54 | + <CardTitle className="dark:text-white">Crear cuenta</CardTitle> |
| 55 | + </CardHeader> |
| 56 | + <CardContent> |
| 57 | + <form onSubmit={handleSubmit} className="flex flex-col gap-4"> |
| 58 | + <div className="flex flex-col gap-1"> |
| 59 | + <label htmlFor="nombre" className="text-sm font-medium text-azul-ultramar dark:text-white">Nombre</label> |
| 60 | + <input |
| 61 | + id="nombre" |
| 62 | + type="text" |
| 63 | + autoComplete="given-name" |
| 64 | + className="border border-azul-crayon rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-azul-crayon bg-white dark:bg-black text-base" |
| 65 | + value={nombre} |
| 66 | + onChange={e => setNombre(e.target.value)} |
| 67 | + required |
| 68 | + /> |
| 69 | + </div> |
| 70 | + <div className="flex flex-col gap-1"> |
| 71 | + <label htmlFor="apellido" className="text-sm font-medium text-azul-ultramar dark:text-white">Apellido</label> |
| 72 | + <input |
| 73 | + id="apellido" |
| 74 | + type="text" |
| 75 | + autoComplete="family-name" |
| 76 | + className="border border-azul-crayon rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-azul-crayon bg-white dark:bg-black text-base" |
| 77 | + value={apellido} |
| 78 | + onChange={e => setApellido(e.target.value)} |
| 79 | + required |
| 80 | + /> |
| 81 | + </div> |
| 82 | + <div className="flex flex-col gap-1"> |
| 83 | + <label htmlFor="email" className="text-sm font-medium text-azul-ultramar dark:text-white">Correo electrónico</label> |
| 84 | + <input |
| 85 | + id="email" |
| 86 | + type="email" |
| 87 | + autoComplete="email" |
| 88 | + className="border border-azul-crayon rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-azul-crayon bg-white dark:bg-black text-base" |
| 89 | + value={email} |
| 90 | + onChange={e => setEmail(e.target.value)} |
| 91 | + required |
| 92 | + /> |
| 93 | + </div> |
| 94 | + <div className="flex flex-col gap-1"> |
| 95 | + <label htmlFor="password" className="text-sm font-medium text-azul-ultramar dark:text-white">Contraseña</label> |
| 96 | + <input |
| 97 | + id="password" |
| 98 | + type="password" |
| 99 | + autoComplete="new-password" |
| 100 | + className="border border-azul-crayon rounded-md px-3 py-2 focus:outline-none focus:ring-2 focus:ring-azul-crayon bg-white dark:bg-black text-base" |
| 101 | + value={password} |
| 102 | + onChange={e => setPassword(e.target.value)} |
| 103 | + required |
| 104 | + /> |
| 105 | + </div> |
| 106 | + {error && <span className="text-red-600 text-sm">{error}</span>} |
| 107 | + <Button type="submit" className="w-full mt-2" disabled={loading}> |
| 108 | + {loading ? "Registrando..." : "Registrarse"} |
| 109 | + </Button> |
| 110 | + </form> |
| 111 | + </CardContent> |
| 112 | + <CardFooter className="flex flex-col items-center gap-2"> |
| 113 | + <Link href="/log-in" className="text-xs text-azul-crayon dark:text-white hover:underline mt-2">¿Ya tienes cuenta? Inicia sesión</Link> |
| 114 | + </CardFooter> |
| 115 | + </Card> |
| 116 | + </div> |
| 117 | + ); |
| 118 | +} |
0 commit comments