Implement login/signup pages

This commit implements the login and signup pages for the application.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 01:37:07 +00:00
parent d7e5c0bf48
commit 3b9a6cc8b0
4 changed files with 394 additions and 0 deletions

122
src/pages/Login.tsx Normal file
View File

@@ -0,0 +1,122 @@
import React, { useState } from "react";
import { Link, useNavigate } from "react-router-dom";
import { Label } from "@/components/ui/label";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { ArrowRight, Mail, KeyRound, Eye, EyeOff } from "lucide-react";
import { useToast } from "@/components/ui/use-toast";
const Login = () => {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const { toast } = useToast();
const navigate = useNavigate();
const handleLogin = async (e: React.FormEvent) => {
e.preventDefault();
if (!email || !password) {
toast({
title: "입력 오류",
description: "이메일과 비밀번호를 모두 입력해주세요.",
variant: "destructive",
});
return;
}
setIsLoading(true);
// 실제 로그인 로직은 추후 구현
// 임시로 2초 후 로그인 성공으로 처리
setTimeout(() => {
setIsLoading(false);
toast({
title: "로그인 성공",
description: "환영합니다!",
});
navigate("/");
}, 2000);
};
return (
<div className="min-h-screen flex flex-col items-center justify-center p-6 bg-neuro-background">
<div className="w-full max-w-md">
<div className="text-center mb-8">
<h1 className="text-3xl font-bold text-neuro-accent mb-2"></h1>
<p className="text-gray-500"> </p>
</div>
<div className="neuro-flat p-8 mb-6">
<form onSubmit={handleLogin}>
<div className="space-y-6">
<div className="space-y-2">
<Label htmlFor="email" className="text-base"></Label>
<div className="relative">
<Mail className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
<Input
id="email"
type="email"
placeholder="your@email.com"
value={email}
onChange={(e) => setEmail(e.target.value)}
className="pl-10 neuro-pressed"
/>
</div>
</div>
<div className="space-y-2">
<Label htmlFor="password" className="text-base"></Label>
<div className="relative">
<KeyRound className="absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-500 h-5 w-5" />
<Input
id="password"
type={showPassword ? "text" : "password"}
placeholder="••••••••"
value={password}
onChange={(e) => setPassword(e.target.value)}
className="pl-10 neuro-pressed"
/>
<button
type="button"
onClick={() => setShowPassword(!showPassword)}
className="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500"
>
{showPassword ? <EyeOff className="h-5 w-5" /> : <Eye className="h-5 w-5" />}
</button>
</div>
</div>
<div className="text-right">
<Link to="/forgot-password" className="text-sm text-neuro-accent hover:underline">
?
</Link>
</div>
<Button
type="submit"
className="w-full bg-neuro-accent hover:bg-neuro-accent-light text-white py-6 h-auto"
disabled={isLoading}
>
{isLoading ? "로그인 중..." : "로그인"} {!isLoading && <ArrowRight className="ml-2 h-5 w-5" />}
</Button>
</div>
</form>
</div>
<div className="text-center">
<p className="text-gray-500">
?{" "}
<Link to="/register" className="text-neuro-accent font-medium hover:underline">
</Link>
</p>
</div>
</div>
</div>
);
};
export default Login;