Sha256: 38a9b37d5efce60fc7b052cfc8b6adec8ce5247dbe1f3e5a351038f3cb239a74

Contents?: true

Size: 1.61 KB

Versions: 15

Compression:

Stored size: 1.61 KB

Contents

/* @flow */

import React, { type Node } from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildDataProps } from '../utilities/props'
import { globalProps } from '../utilities/globalProps'
import PbTable from './'

type TableProps = {
  aria?: object,
  children: array<Node> | Node,
  className: string,
  collapse?: "sm" | "md" | "lg",
  container: boolean,
  dark?: boolean,
  data?: object,
  dataTable: boolean,
  disableHover: boolean,
  id?: string,
  responsive: "collapse" | "scroll" | "none",
  singleLine: boolean,
  size: "sm" | "md" | "lg",
}

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',
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const tableCollapseCss = responsive !== 'none' ? `table-collapse-${collapse}` : ''

  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,
        },
        globalProps(props),
        tableCollapseCss,
        className
      )}
        id={id}
    >
      {children}
    </table>
  )
}

export default Table

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
playbook_ui-10.26.0.pre.alpha.display1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.25.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.26.0.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.25.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.25.0.pre.alpha3 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.25.0.pre.treeshaking1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.24.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.24.0.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.23.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.23.0.pre.alpha2 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.23.0.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.22.1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.22.0 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.1.pre.alpha1 app/pb_kits/playbook/pb_table/_table.jsx
playbook_ui-10.21.0 app/pb_kits/playbook/pb_table/_table.jsx