Files
artcraft/frontend/libs/components/file-uploader/src/lib/file-uploader.tsx
T
BFlat b36e4fd27b Refactor: replace fontawesome icons with lucide icons (#1873)
Removes Font Awesome entirely

### Changes

- All ~1,000 icon call sites now import Lucide components directly from
`lucide-react` (`<PlayIcon className="..." />`); no FA packages, tokens,
or `fa*` identifiers remain anywhere.
- New `@storyteller/icons` lib holds the pieces Lucide doesn't ship:
`DynamicIcon` for runtime-chosen icons (`icon={loading ?
LoaderCircleIcon : SaveIcon}`), 11 brand logos (Discord, TikTok, ...) as
inlined CC BY 4.0 paths, and HD/SD quality badges drawn in Lucide's
stroke style.
- Global `.lucide { display: inline-block; width/height: 1.2em }` rule
in each app stylesheet: keeps icons font-relative like FA (1.2em
compensates Lucide's 24px-viewBox/20px-grid padding) and undoes Tailwind
preflight's `svg { display: block }`. Explicit `w-*`/`size-*` utilities
still win.
- FA-only props migrated: `spin` → `animate-spin`, FA size strings → em
values.
- Dropped `@fortawesome/*` + `@awesome.me` kit deps, both `.npmrc`
files, and
the FA rule in `shared-vite-config.ts` (now externalizes
`lucide-react`).
2026-08-10 02:04:45 +07:00

41 lines
1.2 KiB
TypeScript

import { FileUploader as DragDropFileUploader } from "react-drag-drop-files";
// Usage refer to https://github.com/KarimMokhtar/react-drag-drop-files
import type { LucideIcon } from "lucide-react";
import { DragAndDropZone } from "./drag-and-drop-zone";
export const FileUploader = ({
files,
fileTypes,
handleChange,
multiple = false,
fileIcon,
}: {
files: File[];
handleChange: (files: File[]) => void;
fileTypes: string[];
multiple?: boolean;
fileIcon?: LucideIcon;
}) => (
<DragDropFileUploader
handleChange={(result: File | File[]) => {
if (Array.isArray(result)) {
handleChange(result);
} else if (result instanceof File) {
handleChange([result]);
} else {
// react-drag-drop-files may return a FileList from the file picker when multiple=true;
// Array.isArray returns false for FileList, so normalize via Array.from.
handleChange(Array.from(result as unknown as Iterable<File>));
}
}}
name="file"
maxSize={50}
types={fileTypes}
multiple={multiple}
classes="!outline-none"
>
<DragAndDropZone files={files} fileTypes={fileTypes} fileIcon={fileIcon} />
</DragDropFileUploader>
);