import React from 'react'; import { x } from '@xstyled/emotion'; import { Box } from '../lib/layout/Box'; export interface ExportResourceTableColumn { accessor: string; name?: string; style?: string; group?: string; } export interface ExportResourceTableCell { key: string; value: string; } export interface ExportResourceTableRow { cells: ExportResourceTableCell[]; classNames?: string; } export interface ExportResourceTableTemplateProps { sheetTitle?: string; sheetDescription?: string; table: { columns: ExportResourceTableColumn[]; rows: ExportResourceTableRow[]; }; customCSS?: string; } export function ExportResourceTableTemplate({ sheetTitle, sheetDescription, table, customCSS, }: ExportResourceTableTemplateProps) { return ( {(sheetTitle || sheetDescription) && ( {sheetTitle && ( {sheetTitle} )} {sheetDescription && ( {sheetDescription} )} )} {table.columns.map((column) => { let styleObj: React.CSSProperties | undefined; if (column.style) { try { // Handle style as JSON string styleObj = JSON.parse(column.style); } catch { // If parsing fails, ignore the style styleObj = undefined; } } return ( {column.name || column.accessor} ); })} {table.rows.map((row, rowIndex) => ( {row.cells.map((cell) => ( ))} ))} {customCSS && ( )} ); }