import type { Column, RowData } from '@tanstack/react-table'; import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react'; import { cn } from '@/lib/cn'; interface Props { column: Column; title: string; className?: string; } const sortIcons = { asc: ArrowUp, desc: ArrowDown }; export default function DataTableColumnHeader({ column, title, className, }: Props) { if (!column.getCanSort()) { return {title}; } const direction = column.getIsSorted(); const nextDirection = column.getNextSortingOrder(); const label = nextDirection ? `Sort ${title} ${nextDirection === 'asc' ? 'ascending' : 'descending'}` : `Clear ${title} sorting`; const SortIcon = direction ? sortIcons[direction] : ArrowUpDown; return ( ); }