Skip to content

Commit 4ea8d7d

Browse files
committed
Add static user details form component
1 parent 4a1762c commit 4ea8d7d

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use client";
2+
3+
import { TextInput } from "@/components/form/TextInput";
4+
import { UserAvatarInput } from "@/components/form/UserAvatarInput";
5+
import { zodResolver } from "@hookform/resolvers/zod";
6+
import { useForm } from "react-hook-form";
7+
import { Form } from "@/components/ui/form";
8+
import { z } from "zod";
9+
import {
10+
Card,
11+
CardContent,
12+
CardDescription,
13+
CardHeader,
14+
CardTitle,
15+
} from "@/components/ui/card";
16+
import { Button } from "@/components/ui/button";
17+
18+
const FormSchema = z.object({
19+
profilePicture: z.string(), // TODO: change to actual image file type
20+
displayName: z.string(),
21+
});
22+
23+
export default function UserDetailsForm() {
24+
const form = useForm<z.infer<typeof FormSchema>>({
25+
resolver: zodResolver(FormSchema),
26+
defaultValues: {
27+
profilePicture: "",
28+
displayName: "",
29+
},
30+
});
31+
32+
return (
33+
<Card className="mt-3">
34+
<CardHeader>
35+
<CardTitle className="text-xl">Let's setup your profile</CardTitle>
36+
<CardDescription>
37+
Tell us more about yourself so that we can provide you a personalised
38+
experience.
39+
</CardDescription>
40+
</CardHeader>
41+
<CardContent>
42+
<Form {...form}>
43+
<form className="flex flex-col gap-5">
44+
<UserAvatarInput label="Profile Image" name="profilePicture" />
45+
<TextInput
46+
label="Display Name"
47+
name="displayName"
48+
placeholder={"Name"}
49+
className="bg-input-background-100"
50+
/>
51+
<Button className="self-center max-w-40" type="submit">Next</Button>
52+
</form>
53+
</Form>
54+
</CardContent>
55+
</Card>
56+
);
57+
}

0 commit comments

Comments
 (0)