-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgatsby-browser.tsx
48 lines (40 loc) · 998 Bytes
/
gatsby-browser.tsx
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
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
// You can delete this file if you're not using it
/**
* CSS modules
*/
import "./src/styles/global.css";
import "./src/styles/prismjs/github-theme.css";
import "prismjs/plugins/line-numbers/prism-line-numbers.css";
/**
* External modules
*/
import { useEffect } from "react";
import { RecoilRoot } from "recoil";
/**
* Internal modules
*/
import Layout from "./src/components/blog/Layout";
/**
* Type modules
*/
import type { GatsbyBrowser } from "gatsby";
const PageElement: GatsbyBrowser["wrapPageElement"] = ({ element, props }) => {
useEffect(() => {
// Set vh - px as CSS variable
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty("--vh", `${vh}px`);
}, []);
return (
<RecoilRoot>
<Layout {...props}>
{element}
</Layout>
</RecoilRoot>
);
};
export const wrapPageElement = PageElement;