import {ActionIcon, Indicator, Tooltip, useMantineTheme} from '@mantine/core'; import {type MRT_Header, type MRT_TableInstance} from '../types'; import {getPrimaryColor} from '../column.utils'; import {Icon} from "@iconify/react"; interface Props = {}> { header: MRT_Header; table: MRT_TableInstance; } export const MRT_TableHeadCellSortLabel = < TData extends Record = {}, >({ header, table, }: Props) => { const { getState, options: { icons: {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) : column.getNextSortingOrder() === 'desc' ? localization.sortByColumnDesc.replace('{column}', columnDef.header) : localization.sortByColumnAsc.replace('{column}', columnDef.header); const showIndicator = sorting.length >= 2 && column.getSortIndex() !== -1; const isSorted = column.getIsSorted(); if(!isSorted){ return <>; } return ( {column.getIsSorted() === 'desc' ? ( ) : column.getIsSorted() === 'asc' ? ( ) : ( )} ); };