Created
May 6, 2020 17:13
-
-
Save uds5501/2e5f84e28f5d746a806a19fb91822407 to your computer and use it in GitHub Desktop.
dark theme step1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles"; | |
import React, { useState } from "react"; | |
export default function Dashboard() { | |
const [darkState, setDarkState] = useState(false); | |
const palletType = darkState ? "dark" : "light"; | |
const darkTheme = createMuiTheme({ | |
palette: { | |
type: palletType, | |
} | |
}); | |
const handleThemeChange = () => { | |
setDarkState(!darkState); | |
}; | |
return ( | |
<ThemeProvider theme={darkTheme}> | |
<div> Sample Text </div> | |
</ThemeProvider> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment