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