forked from kernel-community/kernel-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.js
37 lines (31 loc) · 1.21 KB
/
gatsby-ssr.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
33
34
35
36
37
import React from 'react'
import { jsx, InitializeColorMode } from 'theme-ui'
import { TranslationProvider } from '@modules/localization'
import Layout from '@modules/layouts/site_layout'
import { NavigationProvider } from '@modules/navigation'
import NotificationProvider from '@modules/notifications/context'
import { Provider, createClient } from 'wagmi'
import { connectors, provider, connectorStorageKey } from '@src/honour/connect'
//Load our Primsjs css and Fonts
import '@modules/layouts/global.css' //<- Load in Prismjs css. Our custom styles have to be loaded this way cause Prismjs is blackboxed from our own code.
const client = createClient({
autoConnect: true,
connectors,
provider,
connectorStorageKey,
})
export const wrapRootElement = ({ element }) => (
<TranslationProvider>
<Provider client={client}>{element}</Provider>
</TranslationProvider>
)
export const wrapPageElement = ({ element, props }) => (
<NavigationProvider>
<NotificationProvider>
<Layout {...props}>{element}</Layout>
</NotificationProvider>
</NavigationProvider>
)
export const onRenderBody = ({ setPreBodyComponents }) => {
setPreBodyComponents([jsx(InitializeColorMode, { key: 'theme-ui-no-flash' })])
}