import { ArrowDown, ArrowUp, ChevronsUpDown } from 'lucide-react' import { TableHead } from '@/components/ui/table' import { useI18n } from '@/i18n' import type { SortState } from '@/lib/table-sort' // Header cell with a state-aware indicator: unsorted → faded ChevronsUpDown, // asc → ArrowUp, desc → ArrowDown. Right-aligned columns put the indicator // LEFT of the label so the label stays flush with its numbers. `aria-sort` // lives on the , where assistive tech expects it. export function SortableHeader({ column, label, align = 'left', className, sort, onToggle }: { column: C label: string align?: 'left' | 'right' className?: string sort: SortState onToggle: (col: C) => void }) { const { t } = useI18n() const direction = sort?.column === column ? sort.direction : null const Indicator = direction === 'asc' ? ArrowUp : direction === 'desc' ? ArrowDown : ChevronsUpDown return ( ) }