forked from transitive-bullshit/nextjs-notion-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path_document.tsx
92 lines (86 loc) · 2.79 KB
/
_document.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import * as React from 'react'
import Document, { Head, Html, Main, NextScript } from 'next/document'
import { IconContext } from '@react-icons/all-files'
export default class MyDocument extends Document {
render() {
return (
<IconContext.Provider value={{ style: { verticalAlign: 'middle' } }}>
<Html lang='en'>
<Head>
<meta
name='google-site-verification'
content='Zd8IhHjBYgO5M3l0oOViRYwa8OXdg2aLSOjUTIwe7yw'
/>
<meta
name='naver-site-verification'
content='a50a08504e695cb943751e7ba6409a62103efc5c'
/>
<link rel='shortcut icon' href='/favicon.png' />
<link
rel='apple-touch-icon'
sizes='256x256'
href='/4212916_education_note_notes_student_icon-3.png'
/>
<link
rel='icon'
type='image/png'
sizes='128x128'
href='/4212916_education_note_notes_student_icon-3.png'
/>
<link
rel='icon'
type='image/png'
sizes='32x32'
href='favicon.png'
/>
<link rel='manifest' href='/manifest.json' />
</Head>
<body>
<script
dangerouslySetInnerHTML={{
__html: `
/** Inlined version of noflash.js from use-dark-mode */
;(function () {
var storageKey = 'darkMode'
var classNameDark = 'dark-mode'
var classNameLight = 'light-mode'
function setClassOnDocumentBody(darkMode) {
document.body.classList.add(darkMode ? classNameDark : classNameLight)
document.body.classList.remove(darkMode ? classNameLight : classNameDark)
}
var preferDarkQuery = '(prefers-color-scheme: dark)'
var mql = window.matchMedia(preferDarkQuery)
var supportsColorSchemeQuery = mql.media === preferDarkQuery
var localStorageTheme = null
try {
localStorageTheme = localStorage.getItem(storageKey)
} catch (err) {}
var localStorageExists = localStorageTheme !== null
if (localStorageExists) {
localStorageTheme = JSON.parse(localStorageTheme)
}
// Determine the source of truth
if (localStorageExists) {
// source of truth from localStorage
setClassOnDocumentBody(localStorageTheme)
} else if (supportsColorSchemeQuery) {
// source of truth from system
setClassOnDocumentBody(mql.matches)
localStorage.setItem(storageKey, mql.matches)
} else {
// source of truth from document.body
var isDarkMode = document.body.classList.contains(classNameDark)
localStorage.setItem(storageKey, JSON.stringify(isDarkMode))
}
})();
`
}}
/>
<Main />
<NextScript />
</body>
</Html>
</IconContext.Provider>
)
}
}