@equinor/fusion-react-styles
Version:
style lib inspired by @material-ui/styles
29 lines (28 loc) • 1.17 kB
JavaScript
import { createContext } from 'react';
import { defaultJss } from './jss-setup';
import { defaultGenerateClassName } from './class-name-generator';
/**
* Theme context for providing theme values throughout the component tree
*
* This context is provided by ThemeProvider and consumed by makeStyles hooks.
* It allows components to access the current theme without prop drilling.
* The context supports extended themes that extend FusionTheme.
*/
export const ThemeContext = createContext(null);
/**
* Styles context for providing JSS configuration throughout the component tree
*
* This context is provided by StylesProvider and consumed by makeStyles hooks.
* It allows components to access JSS configuration without prop drilling.
* Each StylesProvider can override these values to create isolated scopes.
*
* Default values:
* - jss: Default JSS instance with all plugins
* - generateClassName: Default class name generator (no seed)
* - sheetsManager: Empty map (unused, kept for API compatibility)
*/
export const StylesContext = createContext({
jss: defaultJss,
generateClassName: defaultGenerateClassName,
sheetsManager: new Map(),
});