forked from geist-org/geist-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_app.tsx
135 lines (131 loc) · 4.53 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import Head from 'next/head'
import { NextPage } from 'next'
import { AppProps } from 'next/app'
import React, { useEffect, useState } from 'react'
import { MDXProvider } from '@mdx-js/react'
import { CssBaseline, GeistProvider, useTheme, GeistUIThemes, Image } from 'components'
import ConfigContext from 'lib/config-provider'
import useDomClean from 'lib/use-dom-clean'
import { HybridCode, HybridLink, Search } from 'lib/components'
import Menu from 'lib/components/layout/menu'
const Application: NextPage<AppProps<{}>> = ({ Component, pageProps }) => {
const theme = useTheme()
const [themeType, setThemeType] = useState<string>()
const [customTheme, setCustomTheme] = useState<GeistUIThemes>(theme)
const themeChangeHandle = (theme: GeistUIThemes) => {
setCustomTheme(theme)
setThemeType(theme.type)
}
useEffect(() => {
const theme = window.localStorage.getItem('theme')
if (theme !== 'dark') return
setThemeType('dark')
}, [])
useDomClean()
return (
<>
<Head>
<title>Geist UI - Modern and minimalist React UI library</title>
<meta name="google" content="notranslate" />
<meta name="twitter:creator" content="@echo_witt" />
<meta name="referrer" content="strict-origin" />
<meta property="og:title" content="Geist UI" />
<meta property="og:site_name" content="Geist UI" />
<meta property="og:url" content="https://geist-ui.dev" />
<link rel="dns-prefetch" href="//geist-ui.dev" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="generator" content="Geist UI" />
<meta
name="description"
content="An open-source design system for building modern websites and applications."
/>
<meta
property="og:description"
content="An open-source design system for building modern websites and applications."
/>
<meta
itemProp="image"
property="og:image"
content="https://user-images.githubusercontent.com/11304944/91128466-dfc96c00-e6da-11ea-8b03-a96e6b98667d.png"
/>
<meta
property="og:image"
content="https://user-images.githubusercontent.com/11304944/91128466-dfc96c00-e6da-11ea-8b03-a96e6b98667d.png"
/>
<meta
property="twitter:image"
content="https://user-images.githubusercontent.com/11304944/91128466-dfc96c00-e6da-11ea-8b03-a96e6b98667d.png"
/>
<meta
name="viewport"
content="initial-scale=1, maximum-scale=1, minimum-scale=1, viewport-fit=cover"
/>
</Head>
<GeistProvider themeType={themeType} themes={[customTheme]}>
<CssBaseline />
<ConfigContext
onThemeChange={themeChangeHandle}
onThemeTypeChange={type => setThemeType(type)}>
<Menu />
<Search />
<MDXProvider
components={{
a: HybridLink,
img: Image,
pre: HybridCode,
}}>
<Component {...pageProps} />
</MDXProvider>
</ConfigContext>
<style global jsx>{`
.tag {
color: ${theme.palette.accents_5};
}
.punctuation {
color: ${theme.palette.accents_5};
}
.attr-name {
color: ${theme.palette.accents_6};
}
.attr-value {
color: ${theme.palette.accents_4};
}
.language-javascript {
color: ${theme.palette.accents_4};
}
span.class-name {
color: ${theme.palette.warning};
}
span.maybe-class-name {
color: ${theme.palette.purple};
}
span.token.string {
color: ${theme.palette.accents_5};
}
span.token.comment {
color: ${theme.palette.accents_3};
}
span.keyword {
color: ${theme.palette.success};
}
span.plain-text {
color: ${theme.palette.accents_3};
}
body::-webkit-scrollbar {
width: var(--geist-page-scrollbar-width);
background-color: ${theme.palette.accents_1};
}
body::-webkit-scrollbar-thumb {
background-color: ${theme.palette.accents_2};
border-radius: ${theme.layout.radius};
}
:root {
--geist-page-nav-height: 64px;
--geist-page-scrollbar-width: 4px;
}
`}</style>
</GeistProvider>
</>
)
}
export default Application