@hitachivantara/uikit-react-shared
Version:
Shared React contexts for UI Kit.
29 lines (28 loc) • 782 B
JavaScript
import { createContext, useContext } from "react";
import createCache from "@emotion/cache";
//#region src/context/EmotionContext.ts
var defaultCacheKey = "hv";
var defaultEmotionCache = createCache({
key: "hv",
prepend: true
});
var EmotionContext = createContext({ cache: defaultEmotionCache });
//#endregion
//#region src/context/ThemeContext.ts
var HvThemeContext = createContext({
activeTheme: void 0,
colorModes: [],
selectedMode: "light",
changeMode: () => {},
rootId: void 0,
themes: [],
selectedTheme: "",
changeTheme() {}
});
//#endregion
//#region src/hooks/useEmotionCache.ts
function useEmotionCache() {
return useContext(EmotionContext).cache;
}
//#endregion
export { EmotionContext, HvThemeContext, defaultCacheKey, defaultEmotionCache, useEmotionCache };