import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Button } from '@headlessui/react'; import { ChevronUpDownIcon, ListIcon, GridIcon } from '@/components/icons/Icons'; import { SortBy, SortDirection } from '@/types/documents'; interface SortControlsProps { sortBy: SortBy; sortDirection: SortDirection; onSortByChange: (value: SortBy) => void; onSortDirectionChange: () => void; viewMode: 'list' | 'grid'; onViewModeChange: (mode: 'list' | 'grid') => void; } export function SortControls({ sortBy, sortDirection, onSortByChange, onSortDirectionChange, viewMode, onViewModeChange, }: SortControlsProps) { const sortOptions: Array<{ value: SortBy; label: string, up: string, down: string }> = [ { value: 'name', label: 'Name', up: 'A-Z', down: 'Z-A' }, { value: 'type', label: 'Type', up: 'A-Z', down: 'Z-A' }, { value: 'date', label: 'Date', up: 'Newest', down: 'Oldest' }, { value: 'size', label: 'Size' , up: 'Smallest', down: 'Largest' }, ]; const currentSort = sortOptions.find(opt => opt.value === sortBy); const directionLabel = sortDirection === 'asc' ? currentSort?.up : currentSort?.down; const buttonBaseClass = "h-6 flex items-center justify-center bg-base hover:bg-offbase rounded border border-transparent hover:border-offbase text-xs sm:text-sm transition-all duration-200 ease-in-out hover:scale-[1.04] hover:text-accent"; const activeIconClass = "text-accent"; const inactiveIconClass = "text-muted"; return (