From 49ed4e2b2c158855160da87338d7992054fa26ed Mon Sep 17 00:00:00 2001 From: rajun Date: Tue, 27 Oct 2026 16:28:50 +0530 Subject: [PATCH] feat: add model file picker --- app/components/assets/form/file-picker.tsx | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/components/assets/form/file-picker.tsx diff --git a/app/components/assets/form/file-picker.tsx b/app/components/assets/form/file-picker.tsx new file mode 100644 index 0000000..5cfd1b0 --- /dev/null +++ b/app/components/assets/form/file-picker.tsx @@ -0,0 +1,35 @@ +import { UploadCloud } from 'lucide-react'; +import { DropZone } from '~/components/ui/drop-zone'; +import { Text } from '~/components/ui/text'; +import { SelectedFile } from '~/components/assets/form/selected-file'; +import { formatFileSize } from '~/lib/format'; + +interface FilePickerProps { + id?: string; + accept: string; + file: File | null; + existing: string; + invalid?: boolean; + onFileChange: (file: File | null) => void; + onClearExisting: () => void; +} + +export function FilePicker({ id, accept, file, existing, invalid, onFileChange, onClearExisting }: FilePickerProps) { + return ( + + {file ? ( + onFileChange(null)} /> + ) : existing ? ( + + ) : ( +
+ + + Click to upload or drag a file here{' '} + ({accept}) + +
+ )} +
+ ); +}