Files
gitbook/src/components/DocumentView/Table/RecordRow.tsx
T
Sebastian Graz dae7f704fa Style PR (#34)
* codeblock styling

* fix hover rounding

* checkpoint layout

* improve highlight algo

* v1 syntax theme

* fix table cell add title style

* color tweaks

* opaque sticky numbers

* fix collection spaces

* card aspect fix

* adding back full-width tables

* num tabs

* Add v1 more table types

* format
2023-12-14 16:17:13 +01:00

46 lines
1.5 KiB
TypeScript

import { DocumentTableViewGrid } from '@gitbook/api';
import { tcls } from '@/lib/tailwind';
import { RecordColumnValue } from './RecordColumnValue';
import { TableRecordKV, TableViewProps } from './Table';
export async function RecordRow(
props: TableViewProps<DocumentTableViewGrid> & {
record: TableRecordKV;
},
) {
const { view } = props;
const columnsLengthThreshold = view.columns.length >= 7;
const tableTR = columnsLengthThreshold
? ['[&>*+*]:border-l', '[&>*]:px-4']
: ['[&>*+*]:border-l', '[&>*+*]:pl-4'];
return (
<tr className={tcls(tableTR, 'border-dark/2', 'dark:border-light/2')}>
{view.columns.map((column) => {
return (
<td
key={column}
className={tcls(
'align-baseline',
'min-w-[10rem]',
'border-dark/2',
'py-3',
'text-sm',
'lg:text-base',
'lg:min-w-[12rem]',
'dark:border-light/2',
)}
>
<div className={tcls('pr-4 ', 'textwrap-balance')}>
<RecordColumnValue key={column} {...props} column={column} />
</div>
</td>
);
})}
</tr>
);
}