import { CSSProperties, ReactNode, useMemo } from 'react' import { cn } from 'ui' import { useDataTable } from './providers/DataTableProvider' interface DataTableSideBarLayoutProps { children: ReactNode className?: string topBarHeight?: number } export function DataTableSideBarLayout({ children, className, topBarHeight = 0, }: DataTableSideBarLayoutProps) { const { table } = useDataTable() /** * https://tanstack.com/table/v8/docs/guide/column-sizing#advanced-column-resizing-performance * Instead of calling `column.getSize()` on every render for every header * and especially every data cell (very expensive), * we will calculate all column sizes at once at the root table level in a useMemo * and pass the column sizes down as CSS variables to the