Skip to content

Commit

Permalink
Move ItemTable to module folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Aug 19, 2020
1 parent 0c763ee commit 2b1130f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/ItemTable.js → src/components/ItemTable/ItemTable.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useState, useEffect } from 'react';
import PropTypes from 'prop-types'
import MaterialTable from "material-table";

function ItemTable(props) {
export default function ItemTable({ setActiveItem, setSidebarOpen }) {

const columns = [
{ title: 'Queue', field: 'queue', filterPlaceholder: "Ex: \"ME\"" },
Expand All @@ -12,9 +13,9 @@ function ItemTable(props) {
{ title: 'Status', field: 'status', filterPlaceholder: "Ex: \"Wating for Reply\"" },
{ title: 'Priority', field: 'priority', filterPlaceholder: "Ex: \"covid\"" },
{ title: 'Last Updated', field: 'lastUpdated', filterPlaceholder: "Ex: \"07-27-20 12:54 PM\"" },
// { title: 'Department', field: 'department', filterPlaceholder: "Ex: \"Business Office\"" },
// { title: 'Building', field: 'building', filterPlaceholder: "Ex: \"KNOY\"" },
// { title: 'Date Received', field: 'dateReceived', filterPlaceholder: "Ex: \"07-20-20 03:32 AM\"" },
{ title: 'Department', field: 'department', filterPlaceholder: "Ex: \"Business Office\"" },
{ title: 'Building', field: 'building', filterPlaceholder: "Ex: \"KNOY\"" },
{ title: 'Date Received', field: 'dateReceived', filterPlaceholder: "Ex: \"07-20-20 03:32 AM\"" },
]

const [data, setData] = useState([])
Expand All @@ -40,11 +41,16 @@ function ItemTable(props) {
title={"Demo Table"}
options={options}
onRowClick={(event, rowData) => {
props.setActiveItem(rowData);
props.setSidebarOpen(true);
setActiveItem(rowData);
setSidebarOpen(true);
}}
/>
);
}

export default ItemTable;
ItemTable.propTypes = {
/** Function to set active item on row click. */
"setActiveItem": PropTypes.func.isRequired,
/** Function to toggle sidebar on row click. */
"setSidebarOpen": PropTypes.func.isRequired
}
4 changes: 4 additions & 0 deletions src/components/ItemTable/ItemTable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The ItemTable is a modified version of [material-table](https://material-table.com/) the primary view for webqueue2. It displays metadata for items of selected queues and allows for filtering. By default, it is pre-configured to fetch data the webqueue2 API.
```jsx
<ItemTable setActiveItem={{}} setSidebarOpen={{}} />
```
3 changes: 3 additions & 0 deletions src/components/ItemTable/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ItemTable from "./ItemTable";

export default ItemTable;

0 comments on commit 2b1130f

Please sign in to comment.