Files
artcraft/app/components/reusable/UploadModal/FileUploader.tsx
T
wilandwil a8d0541c31 Feature/ Sets Tab; Fixes/ Tabs Improvements (#578)
Tabs Improvements:
- refactor tabs so no more race condition revolving unneccessary signals
- clean up signals
- refactor upload modal movement to be non-signaled and generalized for
more files types
- better naming for files and components, better error handling, eslint
type any fix
- upload file screen can use less state rerenders and better error
messages

Object Uploader
- adapt the old object upload modal with 3d object preview into the
updated best version of upload modal
- preview loader code improvements, better flow and organization

Sets Tab:
- create a set tab, it currently show objects
- hide it behind a FeatureFlag

---------

Co-authored-by: wil <wil@storyteller.ai>
2024-07-07 21:19:07 -04:00

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>
);
};