Skip to content

Instantly share code, notes, and snippets.

@mfix22
Last active July 16, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfix22/b30bcd63d97ecfb922c3b87cfa60aada to your computer and use it in GitHub Desktop.
Save mfix22/b30bcd63d97ecfb922c3b87cfa60aada to your computer and use it in GitHub Desktop.
Hook together apollo Query with styled-components ThemeProvider
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