-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlayout.tsx
68 lines (66 loc) · 2.06 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
import { component$, Slot, useContext, useStyles$ } from '@builder.io/qwik';
import { useContent, useLocation } from '@builder.io/qwik-city';
import { ContentNav } from '../../components/content-nav/content-nav';
import { Footer } from '../../components/footer/footer';
import { Header } from '../../components/header/header';
import { OnThisPage } from '../../components/on-this-page/on-this-page';
import { createBreadcrumbs, SideBar } from '../../components/sidebar/sidebar';
import { GlobalStore } from '../../context';
import styles from './docs.css?inline';
import Contributors from '../../components/contributors';
export default component$(() => {
const loc = useLocation();
const noRightMenu = ['/docs/'].includes(loc.url.pathname);
useStyles$(styles);
const { menu } = useContent();
const globalStore = useContext(GlobalStore);
const { url } = useLocation();
const breadcrumbs = createBreadcrumbs(menu, url.pathname);
return (
<div class="docs fixed-header">
<Header />
<nav class="breadcrumbs">
<button
onClick$={() => (globalStore.sideMenuOpen = !globalStore.sideMenuOpen)}
type="button"
title="Toggle left menu"
aria-label="Toggle left menu"
>
<span class="sr-only">Navigation</span>
<svg width="24" height="24">
<path
d="M5 6h14M5 12h14M5 18h14"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
/>
</svg>
</button>
{breadcrumbs.length > 0 ? (
<ol>
{breadcrumbs.map((b) => (
<li>{b.text}</li>
))}
</ol>
) : null}
</nav>
<SideBar />
<main
class={{
'no-right-menu': noRightMenu,
}}
>
<div class="docs-container">
<article>
<Slot />
<Contributors />
</article>
<ContentNav />
<Footer />
</div>
<OnThisPage />
</main>
</div>
);
});