1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 21:14:18 +00:00
pds-2021-g2-nest/code/frontend/src/components/GlobalTheme.js

22 lines
538 B
JavaScript
Raw Normal View History

2021-04-26 16:36:41 +00:00
import React from "react"
import useLocalStorageState from "../hooks/useLocalStorageState"
import ContextTheme from "../contexts/ContextTheme"
/**
* Provides {@link ContextTheme} to all contained elements.
*
* @param children
* @returns {JSX.Element}
* @constructor
*/
export default function GlobalTheme({ children }) {
const [theme, setTheme] = useLocalStorageState("theme", "ThemeDark")
return (
<ContextTheme.Provider value={{theme, setTheme}}>
{children}
</ContextTheme.Provider>
)
}