-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-browser.js
32 lines (30 loc) · 915 Bytes
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React from "react"
import { ThemeProvider, createGlobalStyle } from "styled-components"
import { ApolloProvider } from "@apollo/client"
import client from "./src/apollo/client"
import Layout from "./src/components/layout"
import themeContext from "./src/utils/style/theme"
const GlobalStyle = createGlobalStyle`
body {
margin: 0;
height: 100vh;
width: 100%;
}
#___gatsby,
#gatsby-focus-wrapper {
height: 100vh;
width: 100%;
}
`
export const wrapRootElement = ({ element }) => (
<ThemeProvider theme={themeContext}>
<GlobalStyle />
<ApolloProvider client={client}>{element}</ApolloProvider>
{/* {element} */}
</ThemeProvider>
)
export const wrapPageElement = ({ element, props }) => {
// props provide same data to Layout as Page element will get
// including location, data, etc - you don't need to pass it
return <Layout {...props}>{element}</Layout>
}