import { IconArrowsSort, IconChevronDown, IconChevronUp } from "@tabler/icons-react"; import { flexRender } from "@tanstack/react-table"; import type { TableLayoutProps } from "src/components"; function TableHeader(props: TableLayoutProps) { const { tableInstance } = props; const headerGroups = tableInstance.getHeaderGroups(); return ( {headerGroups.map((headerGroup: any) => ( {headerGroup.headers.map((header: any) => { const { column } = header; const { className } = (column.columnDef.meta as any) ?? {}; const canSort = column.getCanSort(); const sortDir = column.getIsSorted(); const headerContent = header.isPlaceholder ? null : typeof column.columnDef.header === "string" ? column.columnDef.header : flexRender(column.columnDef.header, header.getContext()); const sortIcon = canSort ? ( sortDir === "asc" ? ( ) : sortDir === "desc" ? ( ) : ( ) ) : null; return ( {headerContent} {sortIcon} ); })} ))} ); } export { TableHeader };