From 9707de3185430cc05c3912171c2560af18689736 Mon Sep 17 00:00:00 2001 From: Arctic Ice Studio Date: Tue, 4 Dec 2018 05:43:54 +0100 Subject: [PATCH] Implement the theme context provider & consumer components Both the context consumer and provider components have been implemented in the `Root` core container component . The consumer is exported which can then be imported in any component to consume the provided values. References: (1) https://github.com/arcticicestudio/nord-docs/issues/36 Associated epic: GH-51 GH-57 --- src/components/containers/core/Root/Root.jsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/containers/core/Root/Root.jsx b/src/components/containers/core/Root/Root.jsx index d8482766..f2d17d41 100644 --- a/src/components/containers/core/Root/Root.jsx +++ b/src/components/containers/core/Root/Root.jsx @@ -12,7 +12,7 @@ import PropTypes from "prop-types"; import { ThemeProvider, createGlobalStyle } from "styled-components"; import modernNormalize from "styled-modern-normalize"; -import theme, { globals, normalize } from "styles/theme"; +import theme, { globals, normalize, MODE_BRIGHT_SNOW_FLURRY } from "styles/theme"; import "inter-ui/inter-ui.css"; import "typeface-rubik/index.css"; @@ -30,6 +30,20 @@ const GlobalStyle = createGlobalStyle` ${normalize}; `; +/** + * The context provider component for global theme mode consumers. + * + * @since 0.2.0 + */ +const GlobalThemeModeContext = React.createContext(MODE_BRIGHT_SNOW_FLURRY); + +/** + * The context consumer component for the global theme mode. + * + * @since 0.2.0 + */ +const GlobalThemeMode = GlobalThemeModeContext.Consumer; + /** * The root container with injected global CSS styles. *