ThemeProvider (#677)

closes #655
This commit is contained in:
Tom Moor
2018-06-09 19:10:30 -07:00
committed by GitHub
parent 0942deec38
commit 434129a434
50 changed files with 277 additions and 324 deletions

View File

@ -2,15 +2,22 @@
import * as React from 'react';
import ReactDOMServer from 'react-dom/server';
import { Helmet } from 'react-helmet';
import { ServerStyleSheet, StyleSheetManager } from 'styled-components';
import {
ServerStyleSheet,
StyleSheetManager,
ThemeProvider,
} from 'styled-components';
import Layout from '../pages/components/Layout';
import theme from '../../shared/styles/theme';
const sheet = new ServerStyleSheet();
export default function renderpage(ctx: Object, children: React.Node) {
const html = ReactDOMServer.renderToString(
<StyleSheetManager sheet={sheet.instance}>
<Layout>{children}</Layout>
<ThemeProvider theme={theme}>
<Layout>{children}</Layout>
</ThemeProvider>
</StyleSheetManager>
);