diff --git a/src/App.js b/src/App.js index f27b087..5e8ffcb 100644 --- a/src/App.js +++ b/src/App.js @@ -10,7 +10,7 @@ import { objectIsEmpty } from "./utilities" function App(){ const [darkMode, setDarkMode] = useState(false); const [activeItem, setActiveItem] = useState({}); - const sidebarOpen = !objectIsEmpty(activeItem); + const [sidebarOpen, setSidebarOpen] = useState(false) const theme = createMuiTheme({ "palette": { @@ -56,10 +56,10 @@ function App(){ - + - + diff --git a/src/ItemTable.js b/src/ItemTable.js index 468babd..14f59c6 100644 --- a/src/ItemTable.js +++ b/src/ItemTable.js @@ -39,7 +39,10 @@ function ItemTable(props) { data={data} title={"Demo Table"} options={options} - onRowClick={(event, rowData) => props.setActiveItem(rowData)} + onRowClick={(event, rowData) => { + props.setActiveItem(rowData); + props.setSidebarOpen(true); + }} /> ); } diff --git a/src/ItemView.js b/src/ItemView.js index 3d39e7e..72b7fd6 100644 --- a/src/ItemView.js +++ b/src/ItemView.js @@ -12,7 +12,7 @@ function ItemView(props){ diff --git a/src/ItemViewAppBar.js b/src/ItemViewAppBar.js index 2c9e5ab..e1411a6 100644 --- a/src/ItemViewAppBar.js +++ b/src/ItemViewAppBar.js @@ -21,7 +21,7 @@ export default function ItemViewAppBar(props){ props.setActiveItem({})} + onClick={() => props.setSidebarOpen(false)} TransitionComponent={Zoom} >