2021-04-26 16:36:41 +00:00
|
|
|
import React from "react"
|
2021-04-29 14:58:31 +00:00
|
|
|
import useLocalStorageState from "../../hooks/useLocalStorageState"
|
|
|
|
import ContextTheme from "../../contexts/ContextTheme"
|
2021-04-26 16:36:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 (
|
2021-05-11 14:37:15 +00:00
|
|
|
<ContextTheme.Provider value={{ theme, setTheme }}>
|
2021-04-26 16:36:41 +00:00
|
|
|
{children}
|
|
|
|
</ContextTheme.Provider>
|
|
|
|
)
|
|
|
|
}
|