import classNames from 'classnames'; import { DetailedHTMLProps, FC, TableHTMLAttributes } from 'react'; import TableBody, { TableBodyProps } from './components/body/TableBody'; import TableCell, { TableCellProps } from './components/cell/TableCell'; import TableContainer, { TableContainerProps } from './components/container/TableContainer'; import TableHead, { TableHeadProps } from './components/head/TableHead'; import TableHeaderCell, { TableHeaderCellProps } from './components/header-cell/TableHeaderCell'; import TableSortLabel, { TableSortLabelProps } from './components/label/TableSortLabel'; import TableRow, { TableRowProps } from './components/row/TableRow'; interface TableCompoundProps { Body: FC; Cell: FC; Container: FC; Head: FC; HeaderCell: FC; Row: FC; SortLabel: FC; } export interface TableProps extends DetailedHTMLProps, HTMLTableElement> { className?: string; } const Table: FC & TableCompoundProps = ({ className, children, ...props }) => { const tableClassName = classNames('table', className); return ( {children}
); }; Table.Body = TableBody; Table.Cell = TableCell; Table.Container = TableContainer; Table.Head = TableHead; Table.HeaderCell = TableHeaderCell; Table.Row = TableRow; Table.SortLabel = TableSortLabel; Table.displayName = 'Table'; export default Table;