diff --git a/src/components/Folder/Folder.module.css b/src/components/Folder/Folder.module.css index dce2135..df09f1e 100644 --- a/src/components/Folder/Folder.module.css +++ b/src/components/Folder/Folder.module.css @@ -66,17 +66,36 @@ } } +/* settings dropdown */ +.settings { + margin-left: 8px; + + & button::before { + /* hide caret */ + display: none; + } + + & svg { + opacity: 0.8; + transition: opacity 0.2s; + } + + &:hover svg { + opacity: 1; + } +} + /* search */ .search { background: #fff url("../../assets/search.svg") no-repeat center right 8px; border: 1px solid transparent; - border-radius: 12px; + border-radius: 8px; flex-shrink: 1; font-size: 12px; height: 24px; min-width: 0; outline: none; - padding: 4px 20px 2px 8px; + padding: 5px 20px 5px 10px; width: 100px; transition-duration: 0.3s; transition-property: border, width; diff --git a/src/components/Folder/Folder.tsx b/src/components/Folder/Folder.tsx index 6874ec4..0ec4983 100644 --- a/src/components/Folder/Folder.tsx +++ b/src/components/Folder/Folder.tsx @@ -4,10 +4,15 @@ import type { DirSource, FileMetadata } from '../../lib/sources/types.js' import { cn, formatFileSize, getFileDate, getFileDateShort } from '../../lib/utils.js' import Breadcrumb from '../Breadcrumb/Breadcrumb.js' import Center from '../Center/Center.js' +import Dropdown from '../Dropdown/Dropdown.js' import Layout from '../Layout/Layout.js' import Spinner from '../Spinner/Spinner.js' import styles from './Folder.module.css' +const gearIcon = + + + interface FolderProps { source: DirSource } @@ -20,6 +25,7 @@ export default function Folder({ source }: FolderProps) { const [files, setFiles] = useState() const [error, setError] = useState() const [searchQuery, setSearchQuery] = useState('') + const [showHiddenFiles, setShowHiddenFiles] = useState(false) const searchRef = useRef(null) const listRef = useRef(null) const { routes, customClass } = useConfig() @@ -34,10 +40,14 @@ export default function Folder({ source }: FolderProps) { }) }, [source]) - // File search + // File search and hidden files filtering const filtered = useMemo(() => { - return files?.filter(file => file.name.toLowerCase().includes(searchQuery.toLowerCase())) - }, [files, searchQuery]) + return files?.filter(file => { + const matchesSearch = file.name.toLowerCase().includes(searchQuery.toLowerCase()) + const isHidden = file.name.startsWith('.') + return matchesSearch && (showHiddenFiles || !isHidden) + }) + }, [files, searchQuery, showHiddenFiles]) useEffect(() => { const searchElement = searchRef.current @@ -90,6 +100,11 @@ export default function Folder({ source }: FolderProps) { return + + + {filtered === undefined ?