Skip to content

Commit 5091366

Browse files
committedSep 13, 2024·
Add new sign up page ui
1 parent a255c18 commit 5091366

File tree

2 files changed

+97
-64
lines changed

2 files changed

+97
-64
lines changed
 

‎app/(auth)/signup/page.tsx

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import SignUp from '@/components/sign-up';
22

33
export default function SignUpPage() {
4-
return (
5-
<div className="container absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]">
6-
<h1 className="text-2xl font-bold mb-4 text-center">Sign Up</h1>
7-
<SignUp />
8-
</div>
9-
);
4+
return <SignUp />;
105
}

‎components/sign-up.tsx

+96-58
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import { signUp } from '@/app/actions/auth-actions';
55
import { useRouter } from 'next/navigation';
66
import Link from 'next/link';
77

8+
import { Button } from '@/components/ui/button';
9+
import {
10+
Card,
11+
CardContent,
12+
CardFooter,
13+
CardHeader,
14+
} from '@/components/ui/card';
15+
import { Input } from '@/components/ui/input';
16+
import { Label } from '@/components/ui/label';
17+
18+
import { UserIcon } from 'lucide-react';
19+
820
export default function SignUp() {
921
const formRef = useRef<HTMLFormElement>(null);
1022
const router = useRouter();
@@ -24,65 +36,91 @@ export default function SignUp() {
2436
<form
2537
ref={formRef}
2638
action={handleSignUp}
27-
className="space-y-4 max-w-md mx-auto"
39+
className="min-h-screen flex items-center justify-center bg-[url('@/public/loader.svg?height=400&width=400')] bg-repeat p-4"
2840
>
29-
<div>
30-
<label htmlFor="username" className="block text-sm font-medium ">
31-
Username
32-
</label>
33-
<input
34-
type="text"
35-
name="username"
36-
id="username"
37-
required
38-
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
39-
/>
40-
</div>
41-
<div>
42-
<label htmlFor="password" className="block text-sm font-medium ">
43-
Password
44-
</label>
45-
<input
46-
type="password"
47-
name="password"
48-
id="password"
49-
required
50-
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
51-
/>
52-
</div>
53-
<div>
54-
<label htmlFor="firstName" className="block text-sm font-medium ">
55-
First Name
56-
</label>
57-
<input
58-
type="text"
59-
name="firstName"
60-
id="firstName"
61-
required
62-
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
63-
/>
64-
</div>
65-
<div>
66-
<label htmlFor="lastName" className="block text-sm font-medium ">
67-
Last Name
68-
</label>
69-
<input
70-
type="text"
71-
name="lastName"
72-
id="lastName"
73-
required
74-
className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50"
75-
/>
76-
</div>
77-
<Link className=" text-indigo-600" href={'/signin'}>
78-
Already a user? Sign in
79-
</Link>
80-
<button
81-
type="submit"
82-
className="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
83-
>
84-
Sign Up
85-
</button>
41+
<Card className="w-full max-w-md shadow-lg">
42+
<CardHeader className="space-y-1 flex flex-col items-center">
43+
<div className="bg-primary text-primary-foreground p-3 rounded-full">
44+
<UserIcon className="h-6 w-6" />
45+
</div>
46+
<h1 className="text-2xl font-bold">Register your account</h1>
47+
<p className="text-muted-foreground">Enter the following details</p>
48+
</CardHeader>
49+
<CardContent className="space-y-4">
50+
<div className="space-y-2">
51+
<Label htmlFor="firstName">First Name</Label>
52+
<Input
53+
type="text"
54+
name="firstName"
55+
id="firstName"
56+
placeholder="Enter your first name"
57+
required
58+
/>
59+
</div>
60+
<div>
61+
<Label htmlFor="lastName">Last Name</Label>
62+
<Input
63+
type="text"
64+
name="lastName"
65+
id="lastName"
66+
placeholder="Enter your last name"
67+
required
68+
/>
69+
</div>
70+
<div className="space-y-2">
71+
<Label htmlFor="username">Username</Label>
72+
<Input
73+
id="username"
74+
type="text"
75+
name="username"
76+
placeholder="Enter your username"
77+
required
78+
/>
79+
</div>
80+
<div className="space-y-2">
81+
<Label htmlFor="password">Password</Label>
82+
<Input
83+
id="password"
84+
type="password"
85+
name="password"
86+
placeholder="Enter your password"
87+
required
88+
/>
89+
</div>
90+
<Button className="w-full" type="submit">
91+
Sign Up
92+
</Button>
93+
</CardContent>
94+
<CardFooter className="flex flex-col space-y-4">
95+
{/* <div className="relative w-full">
96+
<div className="absolute inset-0 flex items-center">
97+
<span className="w-full border-t" />
98+
</div>
99+
<div className="relative flex justify-center text-xs uppercase">
100+
<span className="bg-background px-2 text-muted-foreground">
101+
Or continue with
102+
</span>
103+
</div>
104+
</div>
105+
<div className="flex space-x-2">
106+
<Button variant="outline" className="w-full">
107+
Google
108+
</Button>
109+
<Button variant="outline" className="w-full">
110+
GitHub
111+
</Button>
112+
</div> */}
113+
<p className="text-center text-sm text-muted-foreground">
114+
Already a user?{' '}
115+
<Link
116+
href="/signin"
117+
className="underline underline-offset-4 hover:text-primary"
118+
>
119+
Sign in
120+
</Link>
121+
</p>
122+
</CardFooter>
123+
</Card>
86124
</form>
87125
);
88126
}

0 commit comments

Comments
 (0)
Please sign in to comment.