Last active
July 16, 2019 20:29
-
-
Save mfix22/b30bcd63d97ecfb922c3b87cfa60aada to your computer and use it in GitHub Desktop.
Hook together apollo Query with styled-components ThemeProvider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { merge } from 'lodash' | |
import {ThemeProvider} from 'styled-components' | |
import { theme, CustomStyles } from './styled' // our design system folder | |
// This component wraps the Query component from `apollo-client` | |
import { GetTheme } from './containers' | |
export default function App(props) { | |
return ( | |
<GetTheme> | |
{userTheme => ( | |
<ThemeProvider theme={merge(theme, userTheme)}> | |
{props.children} | |
<CustomStyles> | |
{userTheme.customStyles} | |
</CustomStyles> | |
</ThemeProvider> | |
)} | |
</GetTheme> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment