forked from kernel-community/kernel-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.js
26 lines (20 loc) · 856 Bytes
/
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
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";
//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.
export const wrapRootElement = ({ element }) => (
<TranslationProvider>{element}</TranslationProvider>
);
export const wrapPageElement = ({ element, props }) => (
<NavigationProvider>
<Layout {...props}>{element}</Layout>
</NavigationProvider>
);
export const onRenderBody = ({ setPreBodyComponents }) => {
setPreBodyComponents([
jsx(InitializeColorMode, { key: "theme-ui-no-flash" }),
]);
};