import clsx from 'clsx'; import { CSSProperties, PropsWithChildren, ReactNode } from 'react'; import styles from './TableHeaderCell.module.css'; import { TableHeaderSortIcons } from './TableHeaderSortIcons'; interface Props { canSort: boolean; isSorted: boolean; isSortedDesc?: boolean; onSortClick: (desc: boolean) => void; render: () => ReactNode; renderFilter?: () => ReactNode; className?: string; style?: CSSProperties; } export function TableHeaderCell({ canSort, render, onSortClick, isSorted, isSortedDesc = true, renderFilter, className, style, }: Props) { return (
{render()} {renderFilter ? renderFilter() : null}
); } interface SortWrapperProps { canSort: boolean; isSorted: boolean; isSortedDesc?: boolean; onClick?: (desc: boolean) => void; } function SortWrapper({ canSort, children, onClick = () => {}, isSorted, isSortedDesc = true, }: PropsWithChildren) { if (!canSort) { return <>{children}; } return ( ); } interface TableColumnHeaderAngularProps { colTitle: string; canSort: boolean; isSorted?: boolean; isSortedDesc?: boolean; } export function TableColumnHeaderAngular({ canSort, isSorted, colTitle, isSortedDesc = true, }: TableColumnHeaderAngularProps) { return (
{colTitle}
); }