Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Oct 23, 2020
1 parent 0c0587a commit 5b72c6f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
20 changes: 13 additions & 7 deletions src/components/ItemTable/ItemTable.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState, useEffect } from "react";
import React from "react";
import PropTypes from "prop-types";
import { useTable, useFilters, useFlexLayout, useSortBy } from "react-table";
import { makeStyles, Table, TableBody, TableCell, TableHead, TableRow, TableContainer, TableSortLabel, Paper, Grid, IconButton, useTheme, } from "@material-ui/core";
import { makeStyles, Table, TableBody, TableCell, TableHead, TableRow, TableContainer, TableSortLabel
, Paper, Grid, useTheme, } from "@material-ui/core";
import { useHistory } from "react-router-dom";
import ItemTableFilter from "../ItemTableFilter/"

export default function ItemTable({ items, onRowClick }) {
export default function ItemTable({ data, onRowClick }) {

const theme = useTheme();
const useStyles = makeStyles({
Expand Down Expand Up @@ -40,7 +42,7 @@ export default function ItemTable({ items, onRowClick }) {
{ Header: 'Date Received', accessor: 'dateReceived' },
], []);

const tableInstance = () => useTable(
const tableInstance = useTable(
{
columns,
data,
Expand All @@ -57,7 +59,7 @@ export default function ItemTable({ items, onRowClick }) {
},
useFilters, useFlexLayout, useSortBy
);
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = tableInstance();
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = tableInstance;

return (
<TableContainer component={Paper}>
Expand Down Expand Up @@ -95,7 +97,7 @@ export default function ItemTable({ items, onRowClick }) {
prepareRow(row);
return (
<TableRow
onClick={onRowClick(row)}
onClick={ () => history.push(`/${row.original.queue}/${row.original.number}`) }
className={classes.bandedRows} {...row.getRowProps()}>
{row.cells.map(cell => (
<TableCell {...cell.getCellProps()}>
Expand All @@ -113,5 +115,9 @@ export default function ItemTable({ items, onRowClick }) {

ItemTable.propTypes = {
/** Array of items from all active queues to display in table. */
"items": PropTypes.array.isRequi
"items": PropTypes.array
};

ItemTable.defaultProps = {
"items": []
};
27 changes: 1 addition & 26 deletions src/components/ItemTableFilter/ItemTableFilter.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import { TextField, useTheme, makeStyles } from "@material-ui/core";
import { yellow } from '@material-ui/core/colors';
import { TextField } from "@material-ui/core";

export default function ItemTableFilter({ label, onChange }) {
const theme = useTheme();
const useStyles = makeStyles({
root: {
'& label.Mui-focused': {
color: theme.palette.type === "light" ? "black" : "white",
},
'& .MuiOutlinedInput-root': {
'& fieldset': {
borderColor: theme.palette.type === "light" ? theme.palette.action.disabled : "white",
},
'&:hover fieldset': {
borderColor: theme.palette.type === "light" ? "black" : "white",
},
'&.Mui-focused fieldset': {
borderColor: theme.palette.type === "light" ? "black" : "white",
},
'&.Mui-focused label': {
borderColor: theme.palette.type === "light" ? "black" : "white",
},
},
},
});

const classes = useStyles();

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/theme.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cyan, deepOrange, deepPurple, lightGreen, lightBlue, teal, purple } from '@material-ui/core/colors';
import { deepPurple, teal } from '@material-ui/core/colors';
import { createMuiTheme } from '@material-ui/core/styles'

/**
Expand Down

0 comments on commit 5b72c6f

Please sign in to comment.