UNPKG

@atlaskit/dynamic-table

Version:

A dynamic table displays rows of data with built-in pagination, sorting, and re-ordering functionality.

46 lines (45 loc) 1.24 kB
import _extends from "@babel/runtime/helpers/extends"; import React from 'react'; import { TableBodyCell } from '../styled/table-cell'; import { TableBodyRow } from '../styled/table-row'; const Row = ({ row, head, testId, isFixedSize, isHighlighted }) => { const { cells, ...restRowProps } = row; return /*#__PURE__*/React.createElement(TableBodyRow, _extends({}, restRowProps, { isHighlighted: isHighlighted }, isHighlighted ? { 'data-ts--dynamic-table--table-row--highlighted': true } : null, { testId: row.testId || testId && `${testId}--row-${restRowProps.key}` }), cells.map((cell, cellIndex) => { const { content, testId: cellTestId, ...restCellProps } = cell; const { shouldTruncate, width } = (head || { cells: [] }).cells[cellIndex] || {}; return /*#__PURE__*/React.createElement(TableBodyCell, _extends({ "data-testid": cellTestId || testId && `${testId}--cell-${cellIndex}` }, restCellProps, { isFixedSize: isFixedSize, key: cellIndex, shouldTruncate: shouldTruncate, width: width }), content); })); }; // eslint-disable-next-line @repo/internal/react/require-jsdoc export default Row;