//
— a generic column-defined table, the shape the hive roster
// (name / domain / status chip, one row per hive) needs. Columns own
// their own cell rendering rather than this component knowing about
// any particular row shape, so it stays reusable for the swarm-wide
// agent roster later without a rewrite.
import type { ComponentChildren } from 'preact';
import './Table.css';
export interface TableColumn {
key: string;
header: string;
render: (row: T) => ComponentChildren;
}
export function Table({
columns,
rows,
rowKey,
}: {
columns: TableColumn[];
rows: T[];
rowKey: (row: T) => string;
}) {
return (
{columns.map((c) => (
| {c.header} |
))}
{rows.map((row) => (
{columns.map((c) => (
| {c.render(row)} |
))}
))}
);
}