Sha256: d1f743e79455d402283bca3767cd6fb4fd2d80a563f8163e98c52ab07144c5a0
Contents?: true
Size: 1.75 KB
Versions: 7
Compression:
Stored size: 1.75 KB
Contents
import React, { useEffect } from 'react' import classnames from 'classnames' import { buildAriaProps, buildDataProps } from '../utilities/props' import { globalProps } from '../utilities/globalProps' import PbTable from '.' type TableProps = { aria?: { [key: string]: string }, children: React.ReactNode[] | React.ReactNode, className: string, collapse?: "sm" | "md" | "lg", container: boolean, dark?: boolean, data?: { [key: string]: string }, dataTable: boolean, disableHover: boolean, id?: string, responsive: "collapse" | "scroll" | "none", singleLine: boolean, size: "sm" | "md" | "lg", sticky?: boolean, } const Table = (props: TableProps) => { const { aria = {}, children, className, collapse = 'sm', container = true, dark, data = {}, dataTable = false, disableHover = false, id, responsive = 'collapse', singleLine = false, size = 'sm', sticky = false, } = props const ariaProps = buildAriaProps(aria) const dataProps = buildDataProps(data) const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : '' useEffect(() => { const instance = new PbTable() instance.connect() }, []) return ( <table {...ariaProps} {...dataProps} className={classnames( 'pb_table', `table-${size}`, `table-responsive-${responsive}`, { 'table-card': container, 'table-dark': dark, 'data_table': dataTable, 'single-line': singleLine, 'no-hover': disableHover, 'sticky-header': sticky, }, globalProps(props), tableCollapseCss, className )} id={id} > {children} </table> ) } export default Table
Version data entries
7 entries across 7 versions & 1 rubygems