mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-10 12:01:36 +00:00
28 lines
706 B
TypeScript
28 lines
706 B
TypeScript
import { FileUploader as DragDropFilesUploader } from "react-drag-drop-files";
|
|
import { DragAndDropZone } from "./DragAndDropZone";
|
|
|
|
interface Props {
|
|
title: string;
|
|
fileTypes: string[];
|
|
file: File | null;
|
|
setFile: (file: File | null) => void;
|
|
}
|
|
|
|
export const FileUploader = ({ fileTypes, title, file, setFile }: Props) => {
|
|
return (
|
|
<div className="flex w-full flex-col gap-3">
|
|
{title}
|
|
<DragDropFilesUploader
|
|
handleChange={(file: File | null) => {
|
|
setFile(file);
|
|
}}
|
|
name="file"
|
|
types={fileTypes}
|
|
maxSize={50}
|
|
>
|
|
<DragAndDropZone file={file} fileTypes={fileTypes} />
|
|
</DragDropFilesUploader>
|
|
</div>
|
|
);
|
|
};
|