"use client" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import Image from "next/image" import { useState } from "react" import { z } from "zod" import { zodResolver } from "@hookform/resolvers/zod" import { useForm } from "react-hook-form" import CustomButton from "@/components/ui/customButton" import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, } from "@/components/ui/form" import { Input } from "@/components/ui/input" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" type TOptions = "react" | "node" const data: { id: TOptions name: string icon: string description: string }[] = [ { id: "react", name: "React", icon: "/project-icons/react.svg", description: "A JavaScript library for building user interfaces", }, { id: "node", name: "Node", icon: "/project-icons/node.svg", description: "A JavaScript runtime built on the V8 JavaScript engine", }, ] const formSchema = z.object({ name: z.string().min(1).max(16), visibility: z.enum(["public", "private"]), }) export default function NewProjectModal({ open, setOpen, }: { open: boolean setOpen: (open: boolean) => void }) { const [selected, setSelected] = useState("react") const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { name: "", visibility: "public", }, }) function onSubmit(values: z.infer) { const sandboxData = { type: selected, ...values } } return ( Create A Sandbox
{data.map((item) => ( ))}
( Name )} /> ( Visibility )} /> Submit
) }