From 50ff3c7c751bcb8875f6a0b0c8ea768ea348b615 Mon Sep 17 00:00:00 2001 From: bender Date: Thu, 5 Mar 2026 23:54:27 +0000 Subject: [PATCH] Add src/app/login/page.tsx --- src/app/login/page.tsx | 121 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 src/app/login/page.tsx diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx new file mode 100644 index 0000000..423e454 --- /dev/null +++ b/src/app/login/page.tsx @@ -0,0 +1,121 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; + +export default function LoginPage() { + const router = useRouter(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [error, setError] = useState(""); + const [isLoading, setIsLoading] = useState(false); + + const handleLogin = async (e: React.FormEvent) => { + e.preventDefault(); + setError(""); + setIsLoading(true); + + try { + // Simulate login API call + if (!email || !password) { + setError("Please enter both email and password."); + return; + } + + // Here you would typically make an API call to authenticate + // For now, we'll simulate a successful login + console.log("Login attempt:", { email, password }); + + // Simulate successful login + localStorage.setItem("user_email", email); + router.push("/dashboard"); + } catch (err) { + setError("Login failed. Please try again."); + console.error(err); + } finally { + setIsLoading(false); + } + }; + + const handleRegister = () => { + router.push("/#contact"); + }; + + return ( +
+
+
+

+ Learn German +

+

Login to your account

+ +
+
+ + setEmail(e.target.value)} + placeholder="Enter your email" + className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition" + disabled={isLoading} + /> +
+ +
+ + setPassword(e.target.value)} + placeholder="Enter your password" + className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition" + disabled={isLoading} + /> +
+ + {error && ( +
+ {error} +
+ )} + + +
+ +
+

+ Don't have an account?{" "} + +

+
+ +
+ +
+
+
+
+ ); +}