Skip to content

Commit

Permalink
Rename reactTableProps to TableCellProps
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jan 20, 2021
1 parent 375b679 commit 55de973
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/ItemTable/ItemTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default function ItemTable({ data }) {
switch (cell.column.id) {
case "dateReceived":
return (
<ItemTableCell reactTableCellProps={cell.getCellProps()}>
<ItemTableCell TableCellProps={cell.getCellProps()}>
<RelativeTime value={cell.value} />
</ItemTableCell>
);
Expand All @@ -158,7 +158,7 @@ export default function ItemTable({ data }) {
);
default:
return (
<ItemTableCell reactTableCellProps={cell.getCellProps()}>
<ItemTableCell TableCellProps={cell.getCellProps()}>
{cell.value}
</ItemTableCell>
);
Expand Down
15 changes: 9 additions & 6 deletions src/components/ItemTableCell/ItemTableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React from 'react'
import PropTypes from "prop-types";
import { makeStyles, TableCell, useTheme } from '@material-ui/core'

export default function ItemTableCell({ reactTableCellProps, backgroundColor, children }) {

export default function ItemTableCell({ backgroundColor, children, TableCellProps }) {
const theme = useTheme();

const useStyles = makeStyles({
columnBorders: {
// Add column borders
borderLeftWidth: "1px",
borderLeftStyle: "solid",
borderColor: theme.palette.type === "light" ? theme.palette.grey[300] : theme.palette.grey[500]
Expand All @@ -16,19 +15,23 @@ export default function ItemTableCell({ reactTableCellProps, backgroundColor, ch

const classes = useStyles();
return (
<TableCell style={{ backgroundColor: backgroundColor }} {...reactTableCellProps} classes={{ root: classes.columnBorders }}>
<TableCell
style={{ backgroundColor: backgroundColor }}
classes={{ root: classes.columnBorders }}
{...TableCellProps}
>
{children}
</TableCell>
);
}

ItemTableCell.propTypes = {
/** Props passed from ItemTable. */
"reactTableProps": PropTypes.object,
/** Sets background color*/
"backgroundColor": PropTypes.string,
/** Child object passed to display cell data. */
"children": PropTypes.object,
/** Props applied to the TableCell component. */
"TableCellProps": PropTypes.object

};

Expand Down

0 comments on commit 55de973

Please sign in to comment.