-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-ssr.js
56 lines (52 loc) · 1.48 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import React from 'react';
import { AppProvider } from './src/controllers/AppContext';
export const wrapRootElement = ({ element }) => {
return <AppProvider>{element}</AppProvider>;
};
// accounting for black body. removed z-index: -1; not allowed on gatsby-ssr.js
/*
export const onInitialClientRender = () => {
const applyDelayedStyles = () => {
const styleElement = document.createElement('style');
styleElement.innerHTML = `
body::before {
content: "";
position: fixed;
inset: 0;
background-color: #111111;
}
`;
document.head.appendChild(styleElement);
};
setTimeout(applyDelayedStyles, 4000);
console.log("onInitialClientRender complete");
};
*/
// ideal time probably two seconds if I can get it to stop displaying immmediately
// seeing if this works on phone
/*
export const onRenderBody = ({ setPostBodyComponents }) => {
setPostBodyComponents([
<script
key="applyDelayedStyles"
dangerouslySetInnerHTML={{
__html: `
setTimeout(function() {
var styleElement = document.createElement('style');
styleElement.innerHTML = \`
body::before {
content: "";
position: fixed;
inset: 0;
background-color: #111111;
}
\`;
document.head.appendChild(styleElement);
console.log("onRenderBody complete");
}, 4000);
`,
}}
/>,
]);
};
*/