import { FC, useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import { useDropzone } from 'react-dropzone' type Props = { label: string, } const UploadBox: FC = (props: Props) => { const { t } = useTranslation('global') const [file, setFile] = useState() const onDrop = useCallback((acceptedFiles: File[]) => { setFile(acceptedFiles[0]) }, []) const { getRootProps, getInputProps } = useDropzone({ onDrop }) return (
{props.label}
{ file ? file.name : t('no_select_file') }
) } export default UploadBox