import { Controller, useForm } from "react-hook-form"; // ui import { Button, Input, Tooltip } from "@plane/ui"; // types import { IPage } from "types"; // constants import { PAGE_ACCESS_SPECIFIERS } from "constants/page"; type Props = { handleFormSubmit: (values: IPage) => Promise; handleClose: () => void; data?: IPage | null; }; const defaultValues = { name: "", description: "", access: 0, }; export const PageForm: React.FC = (props) => { const { handleFormSubmit, handleClose, data } = props; const { formState: { errors, isSubmitting }, handleSubmit, control, } = useForm({ defaultValues: { ...defaultValues, ...data }, }); const handleCreateUpdatePage = async (formData: IPage) => { await handleFormSubmit(formData); }; return (

{data ? "Update" : "Create"} Page

( )} />
(
{PAGE_ACCESS_SPECIFIERS.map((access) => ( ))}
{PAGE_ACCESS_SPECIFIERS.find((access) => access.key === value)?.label}
)} />
); };