diff --git a/src/components/ItemTable/ItemTable.js b/src/components/ItemTable/ItemTable.js
index c333551..b6a16df 100644
--- a/src/components/ItemTable/ItemTable.js
+++ b/src/components/ItemTable/ItemTable.js
@@ -12,37 +12,7 @@ import LastUpdatedCell from "../LastUpdatedCell.js/LastUpdatedCell";
export default function ItemTable({ data }) {
const [selectedRow, setSelecetedRow] = useState({ queue: null, number: null });
- // const LastUpdatedCell = ({ time, reactTableCellProps, classes }) => {
- // const lastUpdated = new Date(time).getTime();
- // const now = new Date().getTime();
- // const timeDelta = now - lastUpdated;
- // const day = 24 * 60 * 60 * 1000;
- // const week = day * 7;
- // const month = week * 4;
- // let backgroundColor = "white";
- // if (timeDelta > day && timeDelta <= week) {
- // backgroundColor = red[100]
- // }
- // else if (timeDelta > week && timeDelta <= month) {
- // backgroundColor = red[300]
- // }
- // else if (timeDelta > month) {
- // backgroundColor = red[500]
- // }
-
- // return (
- //
- //
- //
- // );
- // };
const theme = useTheme();
const useStyles = makeStyles({
@@ -107,7 +77,7 @@ export default function ItemTable({ data }) {
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow, } = tableInstance;
return (
-
+
+
{children}
);
}
+
+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,
+
+};
+
+ItemTableCell.defaultProps = {
+ "reactTableProps": {},
+ "backgroundColor": "",
+ "children": {},
+};
\ No newline at end of file
diff --git a/src/components/LastUpdatedCell.js/LastUpdatedCell.js b/src/components/LastUpdatedCell.js/LastUpdatedCell.js
index 27effae..48e0c7e 100644
--- a/src/components/LastUpdatedCell.js/LastUpdatedCell.js
+++ b/src/components/LastUpdatedCell.js/LastUpdatedCell.js
@@ -1,4 +1,5 @@
import React from 'react'
+import PropTypes from "prop-types";
import { red } from '@material-ui/core/colors';
import RelativeTime from 'react-relative-time';
import ItemTableCell from '../ItemTableCell';
@@ -29,8 +30,25 @@ export default function LastUpdatedCell ({ time, reactTableCellProps, classes }
{...reactTableCellProps}
// Expands style prop of table cell to allow addtion of custom styling without losing default styling.
style={{...reactTableCellProps.style, backgroundColor: backgroundColor }}
+ backgroundColor={backgroundColor}
>
);
}
+
+LastUpdatedCell.propTypes = {
+ /** Time value in ISO8601. */
+ "time": PropTypes.string,
+ /** Props passed from ItemTable. */
+ "reactTableProps": PropTypes.object,
+ /**Object that passes classes to the component. */
+ "classes": PropTypes.object,
+
+};
+
+LastUpdatedCell.defaultProps = {
+ "time": "",
+ "reactTableProps": {},
+ "classes": {},
+};
\ No newline at end of file