mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
21 lines
546 B
JavaScript
21 lines
546 B
JavaScript
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>
|
|
)
|
|
}
|