import PrimaryButton from "@/Components/PrimaryButton" import SecondaryButton from "@/Components/SecondaryButton" import InputLabel from "@/Components/InputLabel" import Modal from "@/Components/Modal" import TextInput from "@/Components/TextInput" import { useState } from "react" import { toast } from "react-toastify" const CreateFile = ({ path, fileType, setCreateFileType, refreshFiles }) => { const [file, setFile] = useState(''); const createFile = (e) => { e.preventDefault() console.log(`create ${fileType} with name ${file} clicked`); window.axios.post('/filemanager/create-file', { path, fileName: file, fileType }).then((response) => { toast(response.data.message, { type: 'success' }) setCreateFileType(false) refreshFiles(path); }).catch((error) => { toast('Error', { type: 'error' }) console.log(error); }) }; if (!fileType) { return; } return ( <> setCreateFileType(false)}>

Create a new {fileType} in {path}

setFile(e.target.value) } className="mt-1 block w-3/4" isFocused placeholder={`${fileType} Name`} />
Create {fileType} setCreateFileType(false)}> Cancel
); } export default CreateFile