refactor: simplify register page to single centered card
Remove two-column hero layout, matching the signin page style. Compact centered card: logo, heading, name/email/password form, footer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+34
-116
@@ -9,7 +9,7 @@ import { Label } from "~/components/ui/label";
|
|||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import { Logo } from "~/components/branding/logo";
|
import { Logo } from "~/components/branding/logo";
|
||||||
import { LegalModal } from "~/components/ui/legal-modal";
|
import { LegalModal } from "~/components/ui/legal-modal";
|
||||||
import { Mail, Lock, ArrowRight, User, Clock, Rocket, Zap } from "lucide-react";
|
import { Mail, Lock, ArrowRight, User } from "lucide-react";
|
||||||
|
|
||||||
function RegisterForm() {
|
function RegisterForm() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -27,12 +27,7 @@ function RegisterForm() {
|
|||||||
const res = await fetch("/api/auth/register", {
|
const res = await fetch("/api/auth/register", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({ firstName, lastName, email, password }),
|
||||||
firstName,
|
|
||||||
lastName,
|
|
||||||
email,
|
|
||||||
password,
|
|
||||||
}),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -47,85 +42,25 @@ function RegisterForm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="bg-background flex min-h-screen items-center justify-center">
|
<div className="relative flex min-h-screen items-center justify-center overflow-hidden">
|
||||||
<Card className="mx-auto h-screen w-full overflow-hidden border-0 shadow-none md:h-auto md:max-w-6xl md:border">
|
<div className="pointer-events-none fixed inset-0 -z-10 flex items-center justify-center overflow-hidden">
|
||||||
<CardContent className="grid h-full p-0 md:grid-cols-2">
|
<div className="absolute inset-0 bg-[linear-gradient(to_right,#80808012_1px,transparent_1px),linear-gradient(to_bottom,#80808012_1px,transparent_1px)] bg-[size:24px_24px]"></div>
|
||||||
{/* Hero Section - Hidden on mobile */}
|
<div className="animate-blob h-[800px] w-[800px] rounded-full bg-neutral-400/30 blur-3xl dark:bg-neutral-500/20"></div>
|
||||||
<div className="bg-muted relative hidden md:flex md:flex-col md:justify-center md:p-12">
|
|
||||||
<div className="space-y-8">
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="flex items-center space-x-2">
|
|
||||||
<Logo size="xl" />
|
|
||||||
</div>
|
|
||||||
<div className="space-y-3">
|
|
||||||
<h1 className="text-3xl font-bold lg:text-4xl">
|
|
||||||
Start your
|
|
||||||
<span className="text-primary"> invoicing journey</span>
|
|
||||||
</h1>
|
|
||||||
<p className="text-muted-foreground text-lg">
|
|
||||||
Join thousands of freelancers and small businesses who trust
|
|
||||||
beenvoice to manage their invoicing and get paid faster.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid gap-4">
|
<Card className="mx-auto w-full max-w-md border-border/50 bg-background/80 backdrop-blur-xl">
|
||||||
<div className="flex items-start space-x-4">
|
<CardContent className="p-8">
|
||||||
<div className="bg-primary/10 rounded-lg p-2">
|
<div className="space-y-6">
|
||||||
<Rocket className="text-primary h-5 w-5" />
|
<div className="space-y-2">
|
||||||
</div>
|
|
||||||
<div className="space-y-1">
|
|
||||||
<h3 className="font-semibold">Quick Setup</h3>
|
|
||||||
<p className="text-muted-foreground text-sm">
|
|
||||||
Get started in minutes with our intuitive setup wizard
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-start space-x-4">
|
|
||||||
<div className="bg-primary/10 rounded-lg p-2">
|
|
||||||
<Zap className="text-primary h-5 w-5" />
|
|
||||||
</div>
|
|
||||||
<div className="space-y-1">
|
|
||||||
<h3 className="font-semibold">Fast Payments</h3>
|
|
||||||
<p className="text-muted-foreground text-sm">
|
|
||||||
Professional invoices that get you paid 3x faster
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-start space-x-4">
|
|
||||||
<div className="bg-primary/10 rounded-lg p-2">
|
|
||||||
<Clock className="text-primary h-5 w-5" />
|
|
||||||
</div>
|
|
||||||
<div className="space-y-1">
|
|
||||||
<h3 className="font-semibold">Time Tracking</h3>
|
|
||||||
<p className="text-muted-foreground text-sm">
|
|
||||||
Track time and convert it to accurate invoices instantly
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Sign Up Form */}
|
|
||||||
<div className="flex flex-col justify-center p-6 md:p-12">
|
|
||||||
<div className="mx-auto w-full max-w-sm space-y-6">
|
|
||||||
{/* Mobile Logo */}
|
|
||||||
<div className="flex justify-center md:hidden">
|
|
||||||
<Logo size="lg" />
|
<Logo size="lg" />
|
||||||
|
<div>
|
||||||
|
<h1 className="font-heading text-2xl font-bold">Create your account</h1>
|
||||||
|
<p className="text-muted-foreground text-sm">Get started today</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2 text-center md:text-left">
|
|
||||||
<h1 className="text-2xl font-bold">Create your account</h1>
|
|
||||||
<p className="text-muted-foreground">
|
|
||||||
Supercharge your invoicing today
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form onSubmit={handleRegister} className="space-y-4">
|
<form onSubmit={handleRegister} className="space-y-4">
|
||||||
<div className="grid gap-4 md:grid-cols-2">
|
<div className="grid grid-cols-2 gap-3">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="firstName">First Name</Label>
|
<Label htmlFor="firstName">First Name</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
@@ -137,7 +72,7 @@ function RegisterForm() {
|
|||||||
onChange={(e) => setFirstName(e.target.value)}
|
onChange={(e) => setFirstName(e.target.value)}
|
||||||
required
|
required
|
||||||
autoFocus
|
autoFocus
|
||||||
className="h-11 pl-10"
|
className="h-10 pl-10"
|
||||||
placeholder="John"
|
placeholder="John"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -153,7 +88,7 @@ function RegisterForm() {
|
|||||||
value={lastName}
|
value={lastName}
|
||||||
onChange={(e) => setLastName(e.target.value)}
|
onChange={(e) => setLastName(e.target.value)}
|
||||||
required
|
required
|
||||||
className="h-11 pl-10"
|
className="h-10 pl-10"
|
||||||
placeholder="Doe"
|
placeholder="Doe"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +96,7 @@ function RegisterForm() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="email">Email Address</Label>
|
<Label htmlFor="email">Email</Label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Mail className="text-muted-foreground pointer-events-none absolute top-1/2 left-3 z-10 h-4 w-4 -translate-y-1/2" />
|
<Mail className="text-muted-foreground pointer-events-none absolute top-1/2 left-3 z-10 h-4 w-4 -translate-y-1/2" />
|
||||||
<Input
|
<Input
|
||||||
@@ -170,8 +105,8 @@ function RegisterForm() {
|
|||||||
value={email}
|
value={email}
|
||||||
onChange={(e) => setEmail(e.target.value)}
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
required
|
required
|
||||||
className="h-11 pl-10"
|
className="h-10 pl-10"
|
||||||
placeholder="john@example.com"
|
placeholder="you@example.com"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -186,24 +121,19 @@ function RegisterForm() {
|
|||||||
value={password}
|
value={password}
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
required
|
required
|
||||||
className="h-11 pl-10"
|
minLength={8}
|
||||||
placeholder="Create a strong password"
|
className="h-10 pl-10"
|
||||||
|
placeholder="••••••••"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-muted-foreground text-xs">
|
<p className="text-muted-foreground text-xs">At least 8 characters</p>
|
||||||
Must be at least 8 characters long
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Button
|
<Button type="submit" className="h-10 w-full" disabled={loading}>
|
||||||
type="submit"
|
|
||||||
className="h-11 w-full"
|
|
||||||
disabled={loading}
|
|
||||||
>
|
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<div className="border-primary-foreground/30 border-t-primary-foreground h-4 w-4 animate-spin rounded-full border-2"></div>
|
<div className="border-primary-foreground/30 border-t-primary-foreground h-4 w-4 animate-spin rounded-full border-2" />
|
||||||
<span>Creating account...</span>
|
<span>Creating account…</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
@@ -214,38 +144,26 @@ function RegisterForm() {
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div className="text-center text-sm">
|
<p className="text-muted-foreground text-center text-sm">
|
||||||
Already have an account?{" "}
|
Already have an account?{" "}
|
||||||
<a
|
<a href="/auth/signin" className="text-foreground font-medium hover:underline">
|
||||||
href="/auth/signin"
|
|
||||||
className="text-primary font-medium hover:underline"
|
|
||||||
>
|
|
||||||
Sign in
|
Sign in
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
<div className="text-muted-foreground text-center text-xs leading-relaxed">
|
<p className="text-muted-foreground text-center text-xs">
|
||||||
By creating an account, you agree to our{" "}
|
By creating an account you agree to our{" "}
|
||||||
<LegalModal
|
<LegalModal
|
||||||
type="terms"
|
type="terms"
|
||||||
trigger={
|
trigger={<span className="text-foreground cursor-pointer hover:underline">Terms</span>}
|
||||||
<span className="text-primary inline cursor-pointer hover:underline">
|
|
||||||
Terms of Service
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
/>{" "}
|
/>{" "}
|
||||||
and{" "}
|
and{" "}
|
||||||
<LegalModal
|
<LegalModal
|
||||||
type="privacy"
|
type="privacy"
|
||||||
trigger={
|
trigger={<span className="text-foreground cursor-pointer hover:underline">Privacy Policy</span>}
|
||||||
<span className="text-primary inline cursor-pointer hover:underline">
|
|
||||||
Privacy Policy
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
.
|
.
|
||||||
</div>
|
</p>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user