-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgatsby-browser.js
More file actions
27 lines (25 loc) · 903 Bytes
/
gatsby-browser.js
File metadata and controls
27 lines (25 loc) · 903 Bytes
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
import React from "react";
import { Script } from "gatsby";
import Layout from "./src/components/Layout";
// // Adds a class name to the body element
// exports.onRenderBody = ({ setBodyAttributes }, pluginOptions) => {
// setBodyAttributes({
// className: "page",
// });
// };
// export const onRenderBody = ({ setBodyAttributes }, pluginOptions) => {
// setBodyAttributes({
// className: "page",
// });
// };
export const wrapPageElement = ({ element, props }) => {
return (
<>
<Script id="script-darkmode1" src="/js/darkMode.js" />
<Script id="script-darkmode2">{`localStorage.getItem('darkMode') === 'true' && document.documentElement.setAttribute('data-bs-theme', 'dark');`}</Script>
<Script id="script-header" src="/js/header.js" />
<Script id="script-hamburger" src="/js/hamburger.js" />
<Layout {...props}>{element}</Layout>
</>
);
};