|
| 1 | +"use client"; |
| 2 | +import { useState } from "react"; |
| 3 | +import Link from "next/link"; |
| 4 | + |
| 5 | +export default function LoginPage() { |
| 6 | + const [email, setEmail] = useState(""); |
| 7 | + const [password, setPassword] = useState(""); |
| 8 | + |
| 9 | + const logLoginAttempt = (method: "standard" | "github" | "google") => { |
| 10 | + console.log("Login attempt", { |
| 11 | + method, |
| 12 | + email, |
| 13 | + password, |
| 14 | + }); |
| 15 | + }; |
| 16 | + |
| 17 | + const handleLogin = () => logLoginAttempt("standard"); |
| 18 | + const handleGithubLogin = () => logLoginAttempt("github"); |
| 19 | + const handleGoogleLogin = () => logLoginAttempt("google"); |
| 20 | + |
| 21 | + return ( |
| 22 | + <div className="flex min-h-screen items-center justify-center bg-white p-4 text-slate-900"> |
| 23 | + <div className="w-full max-w-md space-y-6 rounded-lg border border-slate-300 bg-white p-8 shadow-lg"> |
| 24 | + <h1 className="mb-8 text-center text-4xl font-semibold text-slate-900">Login</h1> |
| 25 | + <div className="space-y-4"> |
| 26 | + <div> |
| 27 | + <label htmlFor="email" className="mb-1 block text-sm font-medium text-slate-800"> |
| 28 | + Email |
| 29 | + </label> |
| 30 | + <input |
| 31 | + id="email" |
| 32 | + type="email" |
| 33 | + value={email} |
| 34 | + onChange={(event) => setEmail(event.target.value)} |
| 35 | + className="w-full rounded border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400" |
| 36 | + placeholder="you@example.com" |
| 37 | + /> |
| 38 | + </div> |
| 39 | + <div> |
| 40 | + <label htmlFor="password" className="mb-1 block text-sm font-medium text-slate-800"> |
| 41 | + Password |
| 42 | + </label> |
| 43 | + <input |
| 44 | + id="password" |
| 45 | + type="password" |
| 46 | + value={password} |
| 47 | + onChange={(event) => setPassword(event.target.value)} |
| 48 | + className="w-full rounded border border-slate-300 bg-white px-3 py-2 text-slate-900 placeholder:text-slate-400" |
| 49 | + placeholder="Enter your password" |
| 50 | + /> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + <button |
| 54 | + onClick={handleLogin} |
| 55 | + className="w-full rounded bg-slate-200 py-3 text-lg font-medium text-slate-900 transition hover:bg-slate-300" |
| 56 | + > |
| 57 | + Login |
| 58 | + </button> |
| 59 | + <div className="text-right"> |
| 60 | + <Link |
| 61 | + href="/forgot-password" |
| 62 | + title="Forgot Password?" |
| 63 | + className="text-xs text-slate-700 hover:text-slate-900 hover:underline" |
| 64 | + > |
| 65 | + Forgot Password? |
| 66 | + </Link> |
| 67 | + </div> |
| 68 | + {/* ... Divider ... */} |
| 69 | + <div className="space-y-3"> |
| 70 | + <button |
| 71 | + onClick={handleGithubLogin} |
| 72 | + className="w-full rounded bg-slate-200 py-3 font-medium text-slate-900 transition hover:bg-slate-300" |
| 73 | + > |
| 74 | + Login with Github |
| 75 | + </button> |
| 76 | + <button |
| 77 | + onClick={handleGoogleLogin} |
| 78 | + className="w-full rounded bg-slate-200 py-3 font-medium text-slate-900 transition hover:bg-slate-300" |
| 79 | + > |
| 80 | + Login with Google |
| 81 | + </button> |
| 82 | + </div> |
| 83 | + <p className="mt-4 text-center text-sm text-slate-700"> |
| 84 | + Don't have an account?{" "} |
| 85 | + <Link href="/signup" className="font-semibold text-slate-900 hover:underline"> |
| 86 | + Register |
| 87 | + </Link> |
| 88 | + </p> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + ); |
| 92 | +} |
0 commit comments