Skip to content

Commit

Permalink
Rename reactTableProps to ItemTableCellProps
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jan 21, 2021
1 parent 672b0f9 commit 86b75a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/ItemTable/ItemTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default function ItemTable({ data }) {
return (
<LastUpdatedCell
time={cell.value}
reactTableCellProps={cell.getCellProps()}
ItemTableCellProps={cell.getCellProps()}
/>
);
default:
Expand Down
18 changes: 9 additions & 9 deletions src/components/LastUpdatedCell/LastUpdatedCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@ const timeToBackgroundColor = (time) => {
return backgroundColor;
}

export default function LastUpdatedCell({ time, reactTableCellProps }) {
export default function LastUpdatedCell({ time, ItemTableCellProps }) {
// Insert the calculated background color into props so it isn't overriden.
// Inspired by: https://github.com/mui-org/material-ui/issues/19479
reactTableCellProps = {
...reactTableCellProps,
ItemTableCellProps = {
...ItemTableCellProps,
style: {
...reactTableCellProps.style,
...ItemTableCellProps.style,
backgroundColor: timeToBackgroundColor(time)
}
};

return (
<ItemTableCell TableCellProps={reactTableCellProps}>
<ItemTableCell TableCellProps={ItemTableCellProps}>
<RelativeTime value={time} />
</ItemTableCell>
);
};

LastUpdatedCell.propTypes = {
/** Time value in ISO8601. */
/** ISO 8601 formatted time string. */
"time": PropTypes.string,
/** Props passed from ItemTable. */
"reactTableProps": PropTypes.object,
/** Props to be applied to the ItemTableCell. */
"ItemTableCellProps": PropTypes.object,
};

LastUpdatedCell.defaultProps = {
"time": "",
"reactTableProps": {},
"ItemTableCellProps": {},
};

0 comments on commit 86b75a1

Please sign in to comment.