UNPKG

@equinor/eds-core-react

Version:

The React implementation of the Equinor Design System

41 lines (38 loc) 1.02 kB
import { forwardRef } from 'react'; import { InnerContext } from './Inner.context.js'; import { jsx } from 'react/jsx-runtime'; import { TableDataCell } from './DataCell/DataCell.js'; import { TableFooterCell } from './FooterCell/FooterCell.js'; import { TableHeaderCell } from './HeaderCell/HeaderCell.js'; const Cell = /*#__PURE__*/forwardRef(function Cell({ ...rest }, ref) { return /*#__PURE__*/jsx(InnerContext.Consumer, { children: ({ variant, sticky }) => { switch (variant) { case 'head': return /*#__PURE__*/jsx(TableHeaderCell, { ref: ref, sticky: sticky, ...rest }); case 'foot': return /*#__PURE__*/jsx(TableFooterCell, { ref: ref, sticky: sticky, ...rest }); default: case 'body': return /*#__PURE__*/jsx(TableDataCell, { ref: ref, ...rest }); } } }); }); export { Cell };