import React from 'react'; import Badge from '@mui/material/Badge'; import TableSortLabel from '@mui/material/TableSortLabel'; import Tooltip from '@mui/material/Tooltip'; import { MRT_Header, MRT_TableInstance } from '..'; import type { TableCellProps } from '@mui/material/TableCell'; interface Props { header: MRT_Header; table: MRT_TableInstance; tableCellProps?: TableCellProps; } export const MRT_TableHeadCellSortLabel = ({ header, table, tableCellProps, }: Props) => { const { getState, options: { icons: { ArrowDownwardIcon }, localization, }, } = table; const { column } = header; const { columnDef } = column; const { sorting } = getState(); const sortTooltip = column.getIsSorted() ? column.getIsSorted() === 'desc' ? localization.sortedByColumnDesc.replace('{column}', columnDef.header) : localization.sortedByColumnAsc.replace('{column}', columnDef.header) : localization.unsorted; return ( 1 ? column.getSortIndex() + 1 : 0} overlap="circular" > { e.stopPropagation(); header.column.getToggleSortingHandler()?.(e); }} /> ); };