import clsx from "clsx"; import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react"; import styles from "./SortableTableHeader.module.css"; export type SortDirection = "asc" | "desc"; export type SortState = { key: Key; dir: SortDirection; } | null; export function SortableTableHeader({ label, sortKey, sort, onChange, }: { label: string; sortKey: Key; sort: SortState; onChange: (next: SortState) => void; }) { const active = sort?.key === sortKey; return ( ); } function nextSortState( current: SortState, key: Key, ): SortState { if (current?.key !== key) return { key, dir: "asc" }; if (current.dir === "asc") return { key, dir: "desc" }; return null; }