-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path_app.tsx
41 lines (33 loc) · 1.3 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
import '@/styles/globals.sass'
import {appWithTranslation} from 'next-i18next'
import {Inter, Noto_Serif, Roboto_Mono} from 'next/font/google'
import Script from 'next/script'
import React from 'react'
import {AppearanceProvider} from '@/contexts/AppearanceContext'
import type {AppProps} from 'next/app'
const inter = Inter({subsets: ['latin'], weight: ['400', '500'], variable: '--font-inter'})
const mono = Roboto_Mono({subsets: ['latin'], variable: '--font-roboto-mono'})
const noto = Noto_Serif({subsets: ['latin'], weight: ['400', '700'], variable: '--font-noto'})
function MyApp({Component, pageProps}: AppProps) {
const gaId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID
const gaSource = `https://www.googletagmanager.com/gtag/js?id=${gaId}`
return (
<>
<Script strategy="lazyOnload" src={gaSource} />
<Script strategy="lazyOnload">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${gaId}');
`}
</Script>
<main className={`${inter.variable} ${mono.variable} ${noto.variable} font-sans`}>
<AppearanceProvider>
<Component {...pageProps} />
</AppearanceProvider>
</main>
</>
)
}
export default appWithTranslation(MyApp)