mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
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>
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>
|
|
);
|
|
};
|