import { Box, Button, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, DrawerHeader, DrawerOverlay, FormControl, FormLabel, Input, } from "@chakra-ui/react"; import * as yup from "yup"; import React, { useState } from "react"; import { useForm } from "react-hook-form"; import { yupResolver } from "@hookform/resolvers/yup"; import CustomAlertDialog from "../../Components/CustomAlertDialog"; export const investmentDoct = yup.object().shape({ type: yup.string().required("Sponser name is required"), document: yup.string().required("Sponser name is required"), fileName: yup.string().required("Mobile no is required"), }); const IOArtifactsVideo = ({ isOpen, onClose, secondField }) => { const [file, setFile] = useState(""); const [fileName, setFileName] = useState(""); const [alert, setAlert] = useState(false); const { reset, control, handleSubmit, formState: { errors }, } = useForm({ resolver: yupResolver(investmentDoct), }); const onSubmit = (data) => { setIOArtifactsTwo((prevIOArtifactsTwo) => [ { ...data, status: true, id: uuidv4(), createdAt: new Date().toISOString(), }, ...prevIOArtifactsTwo, ]); setAlert(false); onClose(); }; return ( <> IO Artifacts File Name setFileName(e.target.value)} fontSize={"sm"} type="text" size={"sm"} /> Vimeo video link * setFile(e.target.value)} fontSize={"sm"} type="file" className="form-control" size={"sm"} /> setAlert(false)} alertHandler={handleSubmit(onSubmit)} message={"Are you sure you want to add this document?"} /> ); }; export default IOArtifactsVideo;