import React from 'react' import type { TableProps } from './table' import { classNames } from '../../utils/classNames' import styles from './table.module.scss' export type Props = TableProps const Table = ({ headings, footer, data, hover, striped, offsetStripe, compact, maxHeight, className }: Props) => { const classes = classNames([ styles.table, hover && styles.hover, striped && styles[`striped-${striped}s`], offsetStripe && styles.offset, compact && styles.compact, maxHeight && styles.scroll, className ]) const styleVariables = { ...(maxHeight && { maxHeight }) } as React.CSSProperties return (
{headings?.length && ( {headings.map((heading, index) => ( ))} )} {data.map((row, rowIndex) => ( {row.map((column, columnIndex) => ( ))} {footer?.length && ( {footer.map((data, index) => ( ))} )}
{heading}
))}
{data}
) } export default Table