-
Notifications
You must be signed in to change notification settings - Fork 0
/
theme.config.js
97 lines (94 loc) · 2.58 KB
/
theme.config.js
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
import { useState, useEffect } from "react";
import { useTheme } from "next-themes";
import Navigation from "./components/Navigation";
import { Github, Discord, Twitter } from "./components/Social";
const useDark = () => {
const { resolvedTheme } = useTheme();
const [isDark, setIsDark] = useState(false);
useEffect(() => {
setIsDark(resolvedTheme === "dark");
return () => false;
}, [resolvedTheme]);
return isDark;
};
/** @type import('nextra-theme-docs').DocsThemeConfig */
const theme = {
docsRepositoryBase: "https://github.com/context-labs/context-docs/blob/main",
editLink: {
text: "Edit this page on GitHub",
},
feedback: {
content: "Question? Give us feedback →",
},
toc: {
float: true,
},
logo: function Logo() {
const isDark = useDark();
return (
<>
<img
width="24"
src={`/logo${isDark ? "-dark" : ""}.svg`}
alt="Context Logo"
/>
<span className="w-full font-bold pl-2">Context Documentation</span>
</>
);
},
useNextSeoProps: () => ({
titleTemplate: `%s | Context Documentation`,
openGraph: {
type: "website",
locale: "en_IE",
url: "https://usecontext.io",
siteName: "Context Documentation | Build AI-Powered chatbots",
description:
"Learn how to create the worlds most powerful AI-powered chatbots with Context.",
images: [
{
url: "https://storage.googleapis.com/use-context-production-assets/context-standard-opengraph.png",
alt: "Context Image",
width: 800,
height: 600,
},
],
},
twitter: {
handle: "@contextbots",
site: "@contextbots",
cardType: "summary_large_image",
},
}),
gitTimestamp({ timestamp }) {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [dateString, setDateString] = useState(timestamp.toISOString());
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
try {
setDateString(
timestamp.toLocaleDateString(navigator.language, {
day: "numeric",
month: "long",
year: "numeric",
})
);
} catch (e) {
// Ignore errors here; they get the ISO string.
// At least one person out there has manually misconfigured navigator.language.
}
}, [timestamp]);
return <>Last updated on {dateString}</>;
},
navbar: {
component: <Navigation />,
extraContent: (
<>
<Github />
<Discord />
<Twitter />
</>
),
},
};
export default theme;