import { ActionIcon, Indicator, Tooltip, useMantineTheme } from '@mantine/core'; import { type MRT_Header, type MRT_TableInstance } from '../types'; import { getPrimaryColor } from '../column.utils'; interface Props = {}> { header: MRT_Header; table: MRT_TableInstance; } export const MRT_TableHeadCellSortLabel = < TData extends Record = {}, >({ header, table, }: Props) => { const { getState, options: { icons: { IconSortDescending, IconSortAscending, IconArrowsSort }, localization, }, } = table; const { column } = header; const { columnDef } = column; const { sorting } = getState(); const theme = useMantineTheme(); const sortTooltip = column.getIsSorted() ? column.getIsSorted() === 'desc' ? localization.sortedByColumnDesc.replace('{column}', columnDef.header) : localization.sortedByColumnAsc.replace('{column}', columnDef.header) : localization.unsorted; const showIndicator = sorting.length >= 2 && column.getSortIndex() !== -1; return ( {column.getIsSorted() === 'desc' ? ( ) : column.getIsSorted() === 'asc' ? ( ) : ( )} ); };