forked from BabylonJS/Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_app.tsx
58 lines (52 loc) · 2.06 KB
/
_app.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
49
50
51
52
53
54
55
56
57
58
import type { AppProps } from "next/app";
import Script from "next/script";
import Head from "next/head";
import { useEffect, FunctionComponent, createContext } from "react";
import dynamic from "next/dynamic";
import "../styles/globals.scss";
import "./typedoc/apiPage.global.scss";
export const ColorModeContext = createContext({ toggleColorMode: () => {} });
const ThemeToggle = dynamic(() => import("./toggleColor"), {
ssr: false,
});
export const MyApp: FunctionComponent<AppProps> = ({ Component, pageProps }) => {
useEffect(() => {
// Remove the server-side injected CSS.
const jssStyles = document.querySelector("#jss-server-side");
if (jssStyles) {
jssStyles.parentElement.removeChild(jssStyles);
}
}, []);
return (
<>
<Head>
<title>Babylon.js docs</title>
{/* <script src="https://www.googletagmanager.com/gtag/js?id=G-Q8XDD8TYY2" /> */}
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
</Head>
<ThemeToggle>
<Component {...pageProps} />
<Script src="https://www.googletagmanager.com/gtag/js?id=G-Q8XDD8TYY2" />
<Script id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag('config', 'G-Q8XDD8TYY2');
`}
</Script>
</ThemeToggle>
</>
);
};
export default MyApp;
// Only uncomment this method if you have blocking data requirements for
// every single page in your application. This disables the ability to
// perform automatic static optimization, causing every page in your app to
// be server-side rendered.
//
// MyApp.getInitialProps = async (appContext: AppContext) => {
// // calls page's `getInitialProps` and fills `appProps.pageProps`
// const appProps = await App.getInitialProps(appContext);
// return { ...appProps }
// }