import { zodResolver } from "@hookform/resolvers/zod"; import { Plus } from "lucide-react"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { slugify } from "~/lib/utils"; import { Button } from "./ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "./ui/dialog"; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "./ui/form"; import { Input } from "./ui/input"; const formSchema = z.object({ name: z .string() .min(2, { message: "Volume name must be at least 2 characters long", }) .max(32, { message: "Volume name must be at most 32 characters long", }), }); type FormValues = z.infer; type Props = { open: boolean; setOpen: (open: boolean) => void; onSubmit: (values: FormValues) => void; }; export const CreateVolumeDialog = ({ open, setOpen, onSubmit }: Props) => { const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { name: "", }, }); return ( Create volume Enter a name for the new volume.
( Name field.onChange(slugify(e.target.value))} max={32} min={1} /> Unique identifier for the volume. )} /> {/* {createVolume.error && ( */} {/*
*/} {/* {createVolume.error.message} */} {/*
*/} {/* )} */}
); };