Skip to content

Commit

Permalink
Implement the theme context provider & consumer components
Browse files Browse the repository at this point in the history
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) #36

Associated epic: GH-51
GH-57
  • Loading branch information
arcticicestudio committed Dec 4, 2018
1 parent 8565156 commit 9707de3
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/containers/core/Root/Root.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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.
*
Expand Down

0 comments on commit 9707de3

Please sign in to comment.