import React, { Dispatch, FunctionComponent, useCallback, useState } from 'react'; import { useDropzone } from 'react-dropzone'; import { Box, Stack, Typography } from '@mui/material'; import BlockContent from './upload/BlockContent'; import { styled } from '@mui/material/styles'; import { UploadIllustration } from '../assets'; const DropZoneStyle = styled('div')(({ theme }) => ({ outline: 'none', overflow: 'hidden', position: 'relative', padding: theme.spacing(5, 1), borderRadius: theme.shape.borderRadius, transition: theme.transitions.create('padding'), // backgroundColor: theme.palette.background.neutral, backgroundColor: '#ffffff', border: `2px dashed ${theme.palette.grey[500_32]}`, '&:hover': { cursor: 'pointer', backgroundColor: '#f7f7f7' }, })); const MyDropzone: FunctionComponent<{ setFile: Dispatch; currentImage: string; }> = ({ setFile, currentImage, // onChanges, }) => { const onDrop = useCallback((acceptedFiles) => { // Do something with the files console.log(acceptedFiles); setFile(acceptedFiles[0]); setImage(acceptedFiles[0]); // onChanges(acceptedFiles[0]); }, []); const { getRootProps, getInputProps, isDragActive, isDragReject } = useDropzone({ onDrop, multiple: false, }); const [image, setImage] = useState(null); return ( {image ? ( preview ) : currentImage ? ( preview ) : ( )} Pilih Foto Letakkan foto disini atau klik jelajahi   jelajahi  foto di perangkat Anda {/* */} {isDragReject &&

Unsupported file type...

}
); }; export default MyDropzone;