Add shared dock layouts, navigation cube, range bands, progress actions and comparison surfaces. Extend toolbar menus and loading composition, and align tokens, registry entries, documentation and the living catalog.
20 lines
1.1 KiB
TypeScript
20 lines
1.1 KiB
TypeScript
import type { ReactNode, CSSProperties } from "react";
|
|
export interface ComparisonTableProps {
|
|
density?: "default" | "compact";
|
|
label: string;
|
|
heading: ReactNode;
|
|
columns: readonly { id: string; label: ReactNode }[];
|
|
rows: readonly { id: string; label: ReactNode; cells: readonly ReactNode[] }[];
|
|
}
|
|
/** One label column, one non-collapsing column per entity. Scrolls as a unit. */
|
|
export function ComparisonTable({ density = "default", label, heading, columns, rows }: ComparisonTableProps) {
|
|
return <div className="nodedc-comparison-table" data-density={density} role="region" aria-label={label} tabIndex={0}
|
|
style={{ "--nodedc-comparison-columns": columns.length + 1 } as CSSProperties}>
|
|
<table aria-label={label}>
|
|
<colgroup><col/>{columns.map(column => <col key={column.id}/>)}</colgroup>
|
|
<thead><tr><th scope="col">{heading}</th>{columns.map(column => <th key={column.id} scope="col">{column.label}</th>)}</tr></thead>
|
|
<tbody>{rows.map(row => <tr key={row.id}><th scope="row">{row.label}</th>{columns.map((column, index) => <td key={column.id}>{row.cells[index] ?? "—"}</td>)}</tr>)}</tbody>
|
|
</table>
|
|
</div>;
|
|
}
|