Last active
April 8, 2020 08:37
-
-
Save btodts/158c4680fac0d2c10cf2c2066ba6d79e to your computer and use it in GitHub Desktop.
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 React from "react"; | |
import { useSelector } from "react-redux"; | |
import { ThemeProvider } from "styled-components"; | |
const DarkThemeProvider = ({ children }) => { | |
const darkThemeEnabled = useSelector((state) => state.preferences.darkThemeEnabled); | |
return ( | |
<ThemeProvider theme={{ theme: darkThemeEnabled ? "dark" : "light" }}> | |
{children} | |
</ThemeProvider> | |
); | |
}; | |
export default DarkThemeProvider; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment