forked from denoland/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlayout.tsx
109 lines (101 loc) · 4.33 KB
/
layout.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
import Header from "../_components/Header.tsx";
export default function Layout(props: Lume.Data) {
const reference = props.url.startsWith("/api");
const description = props.description ||
"In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno";
return (
<html
lang="en"
class={`light ${reference ? "" : "h-dvh"}`}
>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{props.title}</title>
<link rel="icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link
rel="preload"
href="/fonts/inter/Inter-Regular.woff2"
as="font"
type="font/woff2"
crossOrigin="true"
/>
<link
rel="preload"
href="/fonts/inter/Inter-SemiBold.woff2"
as="font"
type="font/woff2"
crossOrigin="true"
/>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@deno_land" />
<link rel="me" href="https://fosstodon.org/@deno_land" />
<meta name="twitter:title" content={props.title} />
<meta property="og:title" content={props.title} />
<meta property="og:description" content={description} />
<meta name="twitter:description" content={description} />
<meta name="description" content={description} />
<meta name="twitter:image" content="/img/og.webp" />
<meta
name="twitter:image:alt"
content="Deno docs: Deno documentation, guides, and reference materials. docs.deno.com"
/>
<meta property="og:image" content="/img/og.webp" />
<meta
property="og:image:alt"
content="Deno docs: Deno documentation, guides, and reference materials. docs.deno.com"
/>
<meta property="og:type" content="article" />
<meta property="og:site_name" content="Deno" />
<meta property="og:locale" content="en_US" />
<meta
name="keywords"
content="Deno, JavaScript, TypeScript, reference, documentation, guide, tutorial, example"
/>
<link rel="stylesheet" href="/gfm.css" />
<link rel="stylesheet" href="/styles.css" />
<link rel="stylesheet" href="/overrides.css" />
<script src="/darkmode.client.js"></script>
<script type="module" src="/darkmode-toggle.client.js"></script>
<script type="module" src="/sidebar.client.js"></script>
<script type="module" src="/lint_rules.client.js"></script>
<script type="module" src="/copy.client.js"></script>
<script type="module" src="/tabs.client.js"></script>
<script type="module" src="/feedback.client.js"></script>
<script type="module" src="/youtube-lite.client.js"></script>
<script
async
src="https://www.googletagmanager.com/gtm.js?id=GTM-5B5TH8ZJ"
>
</script>
<link rel="preconnect" href="https://www.googletagmanager.com"></link>
<script>
{/*js*/ `
/* Without this, @media theme preference will override manual theme selection, if different. A little janky but works ok for now, especially since it's just the one edge case where a user's global preference doesn't match their chosen docs theme preference */
window.onload = () => {
const colorThemes = document.querySelectorAll('[data-color-mode]');
const ps = document.querySelectorAll('p');
colorThemes.forEach((el) => {
el.setAttribute('data-color-mode', localStorage.denoDocsTheme || 'auto');
});
}`}
</script>
</head>
<body
class={`bg-background-primary text-foreground-primary ${
reference ? "" : "h-dvh"
}`}
>
<a
href="#content"
class="opacity-0 absolute top-2 left-2 p-2 border -translate-y-12 transition-all focus:translate-y-0 focus:opacity-100 z-50 bg-background-primary font-bold"
>
Skip to main content <span aria-hidden="true">-></span>
</a>
<Header url={props.url} hasSidebar={!!props.sidebar} />
{props.children}
</body>
</html>
);
}