diff --git a/frontend/src/components/MemberAddModal/MemberAddForm.tsx b/frontend/src/components/MemberAddModal/MemberAddForm.tsx new file mode 100644 index 0000000..c98ce7f --- /dev/null +++ b/frontend/src/components/MemberAddModal/MemberAddForm.tsx @@ -0,0 +1,81 @@ +import { zodResolver } from '@hookform/resolvers/zod'; +import { useForm } from 'react-hook-form'; +import { z } from 'zod'; +import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '../ui/form'; +import { Input } from '../ui/input'; +import { Button } from '../ui/button'; +import { Select } from '../ui/select'; + +const formSchema = z.object({ + email: z.string().email({ message: '올바른 이메일 형식을 입력해주세요.' }), + role: z.string().min(1, { message: '역할을 선택해주세요.' }), +}); + +export type MemberAddFormValues = z.infer; + +const defaultValues: Partial = { + email: '', + role: '', +}; + +const roleOptions = [ + { value: 'admin', label: '관리자' }, + { value: 'viewer', label: '뷰어' }, + { value: 'editor', label: '에디터' }, +]; + +export default function MemberAddForm({ onSubmit }: { onSubmit: (data: MemberAddFormValues) => void }) { + const form = useForm({ + resolver: zodResolver(formSchema), + defaultValues, + }); + + return ( +
+ + ( + + 이메일 + + + + + + )} + /> + ( + + 역할 + + + {options.map((option) => ( + + ))} + + + + ); +}); + +Select.displayName = 'Select'; + +export { Select };