mirror of
https://github.com/pds-nest/nest.git
synced 2024-12-01 17:04:19 +00:00
19 lines
638 B
JavaScript
19 lines
638 B
JavaScript
import { createContext } from "react"
|
|
|
|
|
|
/**
|
|
* A context containing an object with the following elements:
|
|
* - `theme` - A string containing the name of the current theme.
|
|
* - `setTheme` - A function that allows changing the `theme`.
|
|
*
|
|
* If trying to access the context from outside a provider, the theme will be `ThemeDark`, and the function will display
|
|
* an error in the console.
|
|
*
|
|
* @type {React.Context}
|
|
*/
|
|
const ContextTheme = createContext({
|
|
isSet: false,
|
|
theme: "ThemeDark",
|
|
setTheme: () => console.error("Provato a eseguire setTheme mentre fuori da un ContextTheme.Provider!"),
|
|
})
|
|
export default ContextTheme
|