import { ArrowDown, ArrowUp, ChevronsUpDown } from 'lucide-react' import { cn } from '@/shared/lib/cn' import type { SortState } from '@/shared/lib/table-sort' /** Заголовок-кнопка столбца со стрелкой сортировки. */ export function SortHeader({ label, sortKey, sort, onToggle, className, }: { label: string sortKey: string sort: SortState onToggle: (key: string) => void className?: string }) { const active = sort.key === sortKey const direction = sort.desc ? 'descending' : 'ascending' let Icon = ChevronsUpDown if (active) Icon = sort.desc ? ArrowDown : ArrowUp return ( // aria-sort — атрибут заголовка столбца, а не кнопки внутри него: у роли button его нет, // и скринридер там его просто не прочтёт. ) }