Spaces:
Paused
Paused
File size: 13,201 Bytes
ebde876 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | "use client"
import { useState } from "react"
import Link from "next/link"
import { useRouter } from "next/navigation"
import { signIn } from "next-auth/react"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Loader2, Sparkles, Eye, EyeOff } from "lucide-react"
export default function LoginPage() {
const router = useRouter()
const [isLoading, setIsLoading] = useState(false)
const [showPassword, setShowPassword] = useState(false)
const [error, setError] = useState("")
async function onSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault()
setIsLoading(true)
setError("")
const formData = new FormData(e.currentTarget)
try {
const result = await signIn("credentials", {
email: formData.get("email"),
password: formData.get("password"),
redirect: false,
})
if (result?.error) {
setError("Invalid email or password")
} else {
router.push("/create")
router.refresh()
}
} catch (error) {
setError("Something went wrong")
} finally {
setIsLoading(false)
}
}
return (
<div className="min-h-screen flex font-sans">
{/* Left Panel - Branding */}
<div className="hidden lg:flex lg:w-1/2 relative overflow-hidden bg-primary/5 border-r-2 border-border">
{/* Background Pattern */}
<div className="absolute inset-0 bg-[linear-gradient(rgba(0,0,0,0.02)_1px,transparent_1px),linear-gradient(90deg,rgba(0,0,0,0.02)_1px,transparent_1px)] dark:bg-[linear-gradient(rgba(255,255,255,0.02)_1px,transparent_1px),linear-gradient(90deg,rgba(255,255,255,0.02)_1px,transparent_1px)] bg-[size:64px_64px]" />
{/* Content */}
<div className="relative z-10 flex flex-col justify-center items-center p-8 text-center w-full">
<div className="space-y-8 max-w-lg">
<div className="inline-flex items-center gap-2 px-3 py-1.5 border-2 border-primary bg-primary/10 shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)]">
<Sparkles className="h-4 w-4 text-primary" />
<span className="text-xs font-black uppercase tracking-widest text-primary">AI Powered</span>
</div>
<h1 className="text-4xl xl:text-5xl font-black tracking-tighter leading-none uppercase">
Create Art That<br />
<span className="text-primary text-stroke-primary">
Breaks Limits
</span>
</h1>
<p className="text-xl text-muted-foreground font-medium uppercase tracking-wide">
Join thousands of artists using Imyra to transform imagination into stunning visuals.
</p>
{/* Stats */}
<div className="flex gap-8 justify-center pt-8">
<div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]">
<p className="text-3xl font-black text-primary">50K+</p>
<p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">Artworks</p>
</div>
<div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]">
<p className="text-3xl font-black text-primary">10K+</p>
<p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">Artists</p>
</div>
<div className="text-center p-4 border-2 border-border bg-card shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)]">
<p className="text-3xl font-black text-primary">Free</p>
<p className="text-xs font-bold uppercase tracking-wider text-muted-foreground mt-1">To Start</p>
</div>
</div>
</div>
</div>
</div>
{/* Right Panel - Form */}
<div className="w-full lg:w-1/2 flex flex-col justify-center p-8 lg:p-12 bg-background relative">
<div className="relative z-10 max-w-sm mx-auto w-full space-y-6">
{/* Logo */}
<Link href="/" className="inline-flex items-center gap-3 mb-6 group">
<div className="h-10 w-10 border-2 border-border bg-primary text-white flex items-center justify-center shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] group-hover:translate-x-[2px] group-hover:translate-y-[2px] group-hover:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:group-hover:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] transition-all">
<Sparkles className="h-5 w-5" />
</div>
<span className="text-xl font-black tracking-tighter uppercase group-hover:text-primary transition-colors">Imyra</span>
</Link>
<div className="space-y-2 border-l-4 border-primary pl-4">
<h2 className="text-3xl font-black tracking-tighter uppercase">Welcome back</h2>
<p className="text-muted-foreground font-medium uppercase tracking-wide text-xs">
Enter your credentials to access your creative studio
</p>
</div>
<form onSubmit={onSubmit} className="space-y-6">
{error && (
<div className="p-4 border-2 border-destructive bg-destructive/5 text-destructive font-bold uppercase tracking-wide text-sm shadow-[4px_4px_0px_0px_rgba(239,68,68,1)]">
{error}
</div>
)}
<div className="space-y-6">
<div className="space-y-2">
<Label htmlFor="email" className="text-sm font-black uppercase tracking-wider">Email</Label>
<Input
id="email"
name="email"
type="email"
placeholder="artist@example.com"
required
className="h-12 rounded-none border-2 border-border bg-card px-3 text-sm font-medium shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] focus:translate-x-[1px] focus:translate-y-[1px] focus:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:focus:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] transition-all"
/>
</div>
<div className="space-y-2">
<div className="flex items-center justify-between">
<Label htmlFor="password" className="text-xs font-black uppercase tracking-wider">Password</Label>
<Link href="#" className="text-[10px] font-bold uppercase tracking-wider text-muted-foreground hover:text-primary hover:underline decoration-2 underline-offset-4">
Forgot password?
</Link>
</div>
<div className="relative">
<Input
id="password"
name="password"
type={showPassword ? "text" : "password"}
placeholder="••••••••"
required
className="h-12 rounded-none border-2 border-border bg-card px-3 text-sm font-medium pr-10 shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] focus:translate-x-[1px] focus:translate-y-[1px] focus:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:focus:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] transition-all"
/>
<Button
type="button"
variant="ghost"
size="icon"
className="absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 hover:bg-transparent text-muted-foreground hover:text-foreground"
onClick={() => setShowPassword(!showPassword)}
>
{showPassword ? <EyeOff className="h-4 w-4" /> : <Eye className="h-4 w-4" />}
</Button>
</div>
</div>
</div>
<Button
type="submit"
disabled={isLoading}
className="w-full h-12 rounded-none border-2 border-primary bg-primary text-white text-base font-black uppercase tracking-widest shadow-[3px_3px_0px_0px_rgba(0,0,0,1)] dark:shadow-[3px_3px_0px_0px_rgba(255,255,255,1)] hover:translate-x-[1px] hover:translate-y-[1px] hover:shadow-[1px_1px_0px_0px_rgba(0,0,0,1)] dark:hover:shadow-[1px_1px_0px_0px_rgba(255,255,255,1)] active:translate-x-[2px] active:translate-y-[2px] active:shadow-none transition-all"
>
{isLoading && <Loader2 className="mr-2 h-5 w-5 animate-spin" />}
Sign In
</Button>
</form>
<div className="relative py-4">
<div className="absolute inset-0 flex items-center">
<div className="w-full border-t-2 border-border" />
</div>
<div className="relative flex justify-center">
<span className="bg-background px-4 text-xs font-black uppercase tracking-widest text-muted-foreground">Or</span>
</div>
</div>
<Button
type="button"
variant="outline"
onClick={() => signIn("google", { callbackUrl: "/create" })}
className="w-full h-14 rounded-none border-2 border-border bg-card text-foreground text-base font-bold uppercase tracking-wider shadow-[4px_4px_0px_0px_rgba(0,0,0,1)] dark:shadow-[4px_4px_0px_0px_rgba(255,255,255,1)] hover:translate-x-[2px] hover:translate-y-[2px] hover:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)] dark:hover:shadow-[2px_2px_0px_0px_rgba(255,255,255,1)] active:translate-x-[4px] active:translate-y-[4px] active:shadow-none transition-all"
>
<svg className="mr-3 h-5 w-5" viewBox="0 0 24 24">
<path fill="currentColor" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z" />
<path fill="currentColor" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" />
<path fill="currentColor" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" />
<path fill="currentColor" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" />
</svg>
Continue with Google
</Button>
<p className="text-center text-sm font-medium text-muted-foreground">
Don't have an account?{" "}
<Link href="/signup" className="text-primary font-black uppercase tracking-wide hover:underline decoration-2 underline-offset-4 ml-1">
Create one free
</Link>
</p>
</div>
</div>
</div>
)
}
|