import { Tooltip, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; import type { HTMLAttributes } from 'react'; import { BORDER_COLOR, GRADIENT } from './constants'; type TableColumnDefinition = { displayName?: string; name: string; tooltip?: string; className?: string; }; type TableProps = { columns: TableColumnDefinition[]; data: Record[]; noHeader?: boolean; noCollapse?: boolean; }; const INNER_BORDER_STYLE = `border-b ${BORDER_COLOR}`; export const Table = ({ columns, data, noHeader = false, noCollapse = false, className, ...props }: TableProps & HTMLAttributes) => { const header = ( {columns.map(({ displayName, name, tooltip }) => ( {displayName} {tooltip ? ( ) : null} ))} ); return ( {!noHeader && header} {data.map((d, i) => ( {columns.map(({ name, displayName, className }, j) => ( ))} ))}
{/** display column name in mobile view */} {!noCollapse && !noHeader && displayName && displayName.length > 0 && ( {displayName} )} {d[name]}
); };