From 26e00de89372a122f7f50787a44f66249af6b374 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Thu, 9 Jul 2020 15:39:04 -0400 Subject: [PATCH] Add dark mode toggle --- src/App.js | 21 +++++++++++++++++---- src/ItemTable.js | 4 +--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index ff90fa8..7ff3919 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,23 @@ -import React from "react"; +import React, { useState } from "react"; +import { ThemeProvider, createMuiTheme } from "@material-ui/core/styles"; +import CustomAppBar from "./CustomAppBar"; import ItemTable from "./ItemTable"; function App(){ - return ( - - ); + const [darkMode, setDarkMode] = useState(false); + + const theme = createMuiTheme({ + "palette": { + "type": darkMode ? "dark" : "light", + } + }) + + return ( + + + + + ); } export default App; \ No newline at end of file diff --git a/src/ItemTable.js b/src/ItemTable.js index 10f170e..e230dd9 100644 --- a/src/ItemTable.js +++ b/src/ItemTable.js @@ -1,9 +1,7 @@ -import React, { useState } from 'react'; +import React from 'react'; import MaterialTable from "material-table"; -import {useTheme} from "@material-ui/core/styles"; function ItemTable() { - const theme = useTheme(); const columns = [ { title: 'Queue', field: 'queue', filterPlaceholder: "Ex: \"ME\""},