From e9b3efe3d5655dac3653d37a097063c4e2c27217 Mon Sep 17 00:00:00 2001 From: Uriel Date: Fri, 5 Sep 2025 14:13:54 -0400 Subject: [PATCH] Add folder icon option for the file input --- gui/src/components/commons/FileInput.tsx | 14 +++++++++-- gui/src/components/commons/TauriFileInput.tsx | 3 ++- .../components/commons/icon/FolderIcon.tsx | 12 +++++++++ .../commons/icon/UploadFolderIcon.tsx | 25 +++++++++++++++++++ 4 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 gui/src/components/commons/icon/FolderIcon.tsx create mode 100644 gui/src/components/commons/icon/UploadFolderIcon.tsx diff --git a/gui/src/components/commons/FileInput.tsx b/gui/src/components/commons/FileInput.tsx index bb4cc8205..f2a341754 100644 --- a/gui/src/components/commons/FileInput.tsx +++ b/gui/src/components/commons/FileInput.tsx @@ -12,6 +12,8 @@ import { FileIcon } from './icon/FileIcon'; import { UploadFileIcon } from './icon/UploadFileIcon'; import { Typography } from './Typography'; import { CloseIcon } from './icon/CloseIcon'; +import { FolderIcon } from './icon/FolderIcon'; +import { UploadFolderIcon } from './icon/UploadFolderIcon'; interface InputProps { variant?: 'primary' | 'secondary'; @@ -22,9 +24,11 @@ interface InputProps { export const FileInputContentBlank = ({ isDragging, label, + directory = false, }: { isDragging: boolean; label: string; + directory?: boolean; }) => { return (
- + {directory ? ( + + ) : ( + + )}
any; + directory?: boolean; }) => { return (
- + {directory ? : } {importedFileName}
diff --git a/gui/src/components/commons/TauriFileInput.tsx b/gui/src/components/commons/TauriFileInput.tsx index 97dd0d943..b858b85c3 100644 --- a/gui/src/components/commons/TauriFileInput.tsx +++ b/gui/src/components/commons/TauriFileInput.tsx @@ -24,10 +24,11 @@ export function InnerTauriFileInput({
onChange(await open({ directory }))}> {value !== null ? FileInputContentFile({ + directory, importedFileName: value, onClearPicker: () => onChange(null), }) - : FileInputContentBlank({ isDragging: false, label })} + : FileInputContentBlank({ isDragging: false, label, directory })}
); } diff --git a/gui/src/components/commons/icon/FolderIcon.tsx b/gui/src/components/commons/icon/FolderIcon.tsx new file mode 100644 index 000000000..14b8a659c --- /dev/null +++ b/gui/src/components/commons/icon/FolderIcon.tsx @@ -0,0 +1,12 @@ +export function FolderIcon({ width = 24 }: { width?: number }) { + return ( + + + + ); +} diff --git a/gui/src/components/commons/icon/UploadFolderIcon.tsx b/gui/src/components/commons/icon/UploadFolderIcon.tsx new file mode 100644 index 000000000..98d2bb82a --- /dev/null +++ b/gui/src/components/commons/icon/UploadFolderIcon.tsx @@ -0,0 +1,25 @@ +import classNames from 'classnames'; + +export function UploadFolderIcon({ + width = 24, + isDragging = false, +}: { + width?: number; + isDragging?: boolean; +}) { + return ( + + + + ); +}