-
Notifications
You must be signed in to change notification settings - Fork 65
/
theme.config.tsx
148 lines (143 loc) · 4.49 KB
/
theme.config.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
136
137
138
139
140
141
142
143
144
145
146
147
148
/* eslint-disable react-hooks/rules-of-hooks */
import React from 'react';
import { useConfig, DocsThemeConfig } from 'nextra-theme-docs';
import FraxIcon from '~/components/Icon/FraxIcon';
import FraxtalIcon from '~/components/Icon/FraxtalIcon';
import { useRouter } from 'next/router';
const config: DocsThemeConfig = {
sidebar: {
defaultMenuCollapseLevel: 2,
autoCollapse: true,
toggleButton: true,
},
useNextSeoProps: () => ({
titleTemplate: '%s | Fraxtal Docs',
}),
logo: () => {
const router = useRouter();
const asPath = router.asPath;
const section = asPath.startsWith('/fraxtal') ? 'fraxtal' : 'frax';
return (
<>
{section === 'fraxtal' && (
<>
<FraxtalIcon size={32} />
<span style={{ marginLeft: 10 }}>Fraxtal Docs</span>
</>
)}
{section === 'frax' && (
<>
<FraxIcon size={32} />
<span style={{ marginLeft: 10 }}>Frax Docs</span>
</>
)}
</>
);
},
themeSwitch: {
useOptions() {
return {
light: 'Dim',
dark: 'Dark',
system: 'System',
};
},
},
project: {
link: 'https://github.com/FraxFinance/docs',
},
darkMode: true,
chat: {
link: 'https://discord.gg/fraxfinance',
},
head: () => {
const router = useRouter();
const { frontMatter } = useConfig();
const asPath = router.asPath;
const section = asPath.startsWith('/fraxtal') ? 'fraxtal' : 'frax';
const faviconImage = section === 'fraxtal' ? '/images/fraxtal-256x256.png' : '/images/frax-256x256.png';
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href={faviconImage} />
<meta name="msapplication-TileColor" content="#000000" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@fraxfinance" />
<meta name="twitter:creator" content="@fraxfinance" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="Frax" />
<meta property="og:title" content={frontMatter.title || 'Fraxtal Docs'} />
<meta property="og:description" content={frontMatter.description || 'Fraxtal Docs'} />
<link rel="preload" as="image" href="/images/fraxtal-256x256.png" />
<link rel="preload" as="image" href="/images/frax-256x256.png" />
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-pro-300-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-pro-400-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-pro-500-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-pro-700-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-mono-300-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-mono-400-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-mono-500-normal.woff2"
/>
<link
rel="preload"
as="font"
crossOrigin="anonymous"
type="font/woff2"
href="https://static.frax.com/fonts/aeonik-mono-700-normal.woff2"
/>
{frontMatter.image ? <meta property="og:image" content={frontMatter.image} /> : null}
{frontMatter.video ? <meta property="og:video" content={frontMatter.video} /> : null}
</>
);
},
docsRepositoryBase: 'https://github.com/FraxFinance/docs/blob/master/',
footer: {
text: 'Fraxtal Docs',
},
nextThemes: {
defaultTheme: 'dark',
},
};
export default config;