Skip to content

Commit

Permalink
fix(table): additional cell content type (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdcabrera committed Apr 20, 2021
1 parent 1d6535f commit 0c22719
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/table/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class Table extends React.Component {
}

cells.forEach(cell => {
if (cell.title !== undefined) {
if (cell?.title !== undefined) {
const { title, ...settings } = cell;
rowObj.cells.push({ title, ...settings });
} else {
Expand All @@ -196,7 +196,7 @@ class Table extends React.Component {
});

columnHeaders.forEach((columnHeader, index) => {
if (columnHeader.title !== undefined) {
if (columnHeader?.title !== undefined) {
const { onSort, sortActive, sortDirection, title, ...settings } = columnHeader;
const tempColumnHeader = {
title,
Expand Down Expand Up @@ -339,8 +339,9 @@ Table.propTypes = {
cells: PropTypes.arrayOf(
PropTypes.oneOfType([
PropTypes.node,
PropTypes.instanceOf(Date),
PropTypes.shape({
title: PropTypes.node.isRequired
title: PropTypes.oneOfType([PropTypes.node, PropTypes.instanceOf(Date)]).isRequired
})
])
),
Expand Down

0 comments on commit 0c22719

Please sign in to comment.