import React from 'react'; import { formatCellValue, typeBadgeClass, typeLabel } from '../lib/format'; import type { ColumnInfo } from '../api/types'; interface Props { rows: Record[]; columns: string[]; schema: ColumnInfo[]; maxRows?: number; } export function TablePreview({ rows, columns, schema, maxRows = 10 }: Props) { return (
{columns.map((name) => { const col = schema.find((c) => c.name === name); return ( ); })} {rows.slice(0, maxRows).map((row, i) => ( {columns.map((name) => ( ))} ))}
{typeLabel(col?.column_type || 'unknown')} {name}
{formatCellValue(row[name])}
); }