import { DocumentTableViewGrid } from '@gitbook/api'; import { tcls } from '@/lib/tailwind'; import { RecordRow } from './RecordRow'; import { TableViewProps } from './Table'; import styles from './table.module.css'; export function ViewGrid(props: TableViewProps) { const { block, view, records, style } = props; const columnsOverThreshold = view.columns.length >= 7; const tableWrapper = columnsOverThreshold ? [ // has over X columns 'w-full', 'overflow-x-auto', 'overflow-y-hidden', 'mx-auto', 'rounded-md', 'border', 'border-dark/2', 'dark:border-light/2', block.data.fullWidth ? [ // has over X columns, and is full width 'max-w-full', ] : [ // NOT full width, but has over X columns 'max-w-4xl', ], ] : [ 'w-full', 'overflow-x-auto', 'overflow-y-hidden', 'mx-auto', // has under X columns block.data.fullWidth ? [ // has under X columns, and is full width 'max-w-full', ] : [ // NOT full width, but has under X columns 'max-w-3xl', ], ]; const tableTR = columnsOverThreshold ? ['[&>*+*]:border-l', '[&>*]:px-4'] : ['[&>*+*]:border-l', '[&>*+*]:px-4']; const tableTH = columnsOverThreshold ? ['py-3'] : ['py-1', 'pt-0']; return (
{/* ProgressScroller: */}
{/* Table: */} {view.hideHeader ? null : ( {view.columns.map((column) => { const columnWidth = view.columnWidths?.[column]; return ( ); })} )} *+*]:border-t')}> {records.map((record) => { return ; })}
{block.data.definition[column].title}
); }