Skip to content

Commit 839e97f

Browse files
committed
create signin & signup pages
1 parent a056de5 commit 839e97f

8 files changed

Lines changed: 488 additions & 19 deletions

File tree

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
"db:migrate": "prisma migrate dev"
1212
},
1313
"dependencies": {
14+
"@hookform/resolvers": "^5.0.1",
1415
"@neondatabase/serverless": "^1.0.0",
1516
"@prisma/client": "^6.8.2",
1617
"@radix-ui/react-accordion": "^1.2.11",
18+
"@radix-ui/react-label": "^2.1.7",
1719
"@radix-ui/react-slot": "^1.2.3",
1820
"better-auth": "^1.2.8",
1921
"class-variance-authority": "^0.7.1",
@@ -23,8 +25,10 @@
2325
"next": "15.3.2",
2426
"react": "^19.0.0",
2527
"react-dom": "^19.0.0",
28+
"react-hook-form": "^7.57.0",
2629
"react-icons": "^5.5.0",
27-
"tailwind-merge": "^3.3.0"
30+
"tailwind-merge": "^3.3.0",
31+
"zod": "^3.25.54"
2832
},
2933
"devDependencies": {
3034
"@biomejs/biome": "1.9.4",

pnpm-lock.yaml

Lines changed: 63 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/auth/signin/page.tsx

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,82 @@
11
'use client'
22
import { Button } from '@/components/ui/button'
3+
import { zodResolver } from '@hookform/resolvers/zod'
4+
import { useForm } from 'react-hook-form'
35
import { FcGoogle } from 'react-icons/fc'
6+
import { z } from 'zod'
47

8+
import {
9+
Form,
10+
FormControl,
11+
FormField,
12+
FormItem,
13+
FormMessage,
14+
} from '@/components/ui/form'
15+
import { Input } from '@/components/ui/input'
516
import { googleSignIn } from '@/lib/google-signin'
617

7-
// export const metadata: Metadata = {
8-
// title: 'Sign In',
9-
// description: 'Sign In to your account',
10-
// }
18+
const formSchema = z.object({
19+
email: z.string().email({
20+
message: 'Please enter a valid email address',
21+
}),
22+
})
23+
24+
type FormValues = z.infer<typeof formSchema>
1125

1226
const SignInPage = () => {
13-
const handleSignIn = async () => {
14-
await googleSignIn()
27+
const form = useForm<FormValues>({
28+
resolver: zodResolver(formSchema),
29+
defaultValues: {
30+
email: '',
31+
},
32+
})
33+
34+
function onSubmit(values: FormValues) {
35+
console.log(values)
1536
}
1637

1738
return (
18-
<div className="flex-center flex-col gap-10">
39+
<div className="flex-center flex-col gap-10 lg:w-1/4">
1940
<div className="flex-center flex-col gap-2">
20-
<h1 className="font-bold text-4xl">Welcome</h1>
21-
<p className="text-lg text-muted-foreground">
41+
<h1 className="font-bold text-4xl text-zinc-900">Welcome Back</h1>
42+
<p className="text-center text-lg text-muted-foreground">
2243
Sign in to your account to continue
2344
</p>
2445
</div>
25-
<Button onClick={handleSignIn} className="w-full p-6 text-lg">
26-
<FcGoogle className="size-6" />
27-
Sign in with Google
28-
</Button>
46+
<div className="flex w-full flex-col gap-4">
47+
<Form {...form}>
48+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
49+
<FormField
50+
control={form.control}
51+
name="email"
52+
render={({ field }) => (
53+
<FormItem>
54+
<FormControl>
55+
<Input
56+
placeholder="Your email"
57+
{...field}
58+
className="bg-zinc-100 p-6 lg:text-lg"
59+
type="email"
60+
/>
61+
</FormControl>
62+
<FormMessage />
63+
</FormItem>
64+
)}
65+
/>
66+
<Button type="submit" className="w-full p-6 text-base ">
67+
Sign in
68+
</Button>
69+
</form>
70+
</Form>
71+
<p className="text-center text-zinc-500">OR</p>
72+
<Button
73+
onClick={async () => await googleSignIn()}
74+
className="p-6 text-base"
75+
>
76+
<FcGoogle className="size-6" />
77+
Continue with Google
78+
</Button>
79+
</div>
2980
</div>
3081
)
3182
}

0 commit comments

Comments
 (0)