diff --git a/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx b/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx index 65d0ba5..c513c6a 100644 --- a/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx +++ b/devsoc24-portal-fe/src/app/edit-idea/edit-idea-form.tsx @@ -1,158 +1,274 @@ -import { Formik, Form, Field, ErrorMessage } from 'formik'; -import { Label } from "@/components/ui/label" -import { Input } from '@/components/ui/input'; -import { Textarea } from "@/components/ui/textarea" +import { zodResolver } from "@hookform/resolvers/zod"; +import { useForm, Controller } from "react-hook-form"; +import { type z } from "zod"; import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@/components/ui/select" -import { Button } from "@/components/ui/button" + Form, + FormControl, + FormField, + FormItem, + FormMessage, +} from "@/components/ui/form"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Button } from "@/components/ui/button"; +import { ideaSchema } from "@/schemas/idea"; interface FormValues { - projectName: string; - projectTrack: string; - description: string; - figmaLink: string; - githubLink: string; - otherLinks: string; + projectName: string; + projectTrack: string; + description: string; + figmaLink: string; + githubLink: string; + otherLinks: string; } -import send from "@/assets/images/Send.svg" -import Image from 'next/image'; -const tracks = ['Track 1', 'Track 2', 'Track 3']; - +import send from "@/assets/images/Send.svg"; +import Image from "next/image"; +const tracks = ["Track 1", "Track 2", "Track 3"]; export default function EditIdeaForm() { - const initialValues: FormValues = { - projectName: '', - projectTrack: '', - description: '', - figmaLink: '', - githubLink: '', - otherLinks: '' - }; - const onSubmit = (values: FormValues, { setSubmitting }: { setSubmitting: (isSubmitting: boolean) => void }) => { - setSubmitting(false); - }; - - return ( - - - {({ isSubmitting }) => ( -
-
-
-
-
- - -
- -
-
-
- - - -
- - -
-
-
- + const form = useForm({ + resolver: zodResolver(ideaSchema), + defaultValues: { + projectName: "", + projectTrack: "", + description: "", + figmaLink: "", + githubLink: "", + otherLinks: "", + }, + mode: "onChange", + }); -