1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-12-01 17:04:19 +00:00
pds-2021-g2-nest/nest_frontend/contexts/ContextTheme.js
2021-05-14 11:31:14 +02:00

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