forked from QwikDev/qwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.tsx
120 lines (118 loc) · 4.01 KB
/
header.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
import { useLocation } from '@builder.io/qwik-city';
import { component$, useStyles$, useContext } from '@builder.io/qwik';
import { DocSearch } from '../docsearch/doc-search';
import { CloseIcon } from '../svgs/close-icon';
import { DiscordLogo } from '../svgs/discord-logo';
import { GithubLogo } from '../svgs/github-logo';
import { MoreIcon } from '../svgs/more-icon';
import { QwikLogo } from '../svgs/qwik-logo';
import { TwitterLogo } from '../svgs/twitter-logo';
import styles from './header.css?inline';
import { GlobalStore } from '../../context';
export const Header = component$(() => {
useStyles$(styles);
const globalStore = useContext(GlobalStore);
const pathname = useLocation().pathname;
return (
<header class="header-container">
<div class="header-inner">
<div class="header-logo">
<a href="/">
<span className="sr-only">Qwik Homepage</span>
<QwikLogo width={180} height={50} />
</a>
</div>
<button
onClick$={() => {
globalStore.headerMenuOpen = !globalStore.headerMenuOpen;
}}
class="mobile-menu"
type="button"
title="Toggle right menu"
aria-label="Toggle right menu"
>
<span class="more-icon">
<MoreIcon width={30} height={30} />
</span>
<span class="close-icon">
<CloseIcon width={30} height={30} />
</span>
</button>
<ul className="md:grow md:flex md:justify-end md:p-4 menu-toolkit">
<li>
<a href="/docs/overview/" class={{ active: pathname.startsWith('/docs') }}>
<span>Docs</span>
</a>
</li>
<li>
<a href="/qwikcity/overview/" class={{ active: pathname.startsWith('/qwikcity') }}>
<span>Qwik City</span>
</a>
</li>
<li>
<a href="/showcase/" class={{ active: pathname.startsWith('/showcase') }}>
<span>Showcase</span>
</a>
</li>
<li>
<a href="/media/" class={{ active: pathname.startsWith('/media') }}>
<span>Media</span>
</a>
</li>
<li>
<a
href="/examples/introduction/hello-world/"
class={{ active: pathname.startsWith('/examples') }}
>
<span>Examples</span>
</a>
</li>
<li>
<a
href="/tutorial/welcome/overview/"
class={{ active: pathname.startsWith('/tutorial') }}
>
<span>Tutorial</span>
</a>
</li>
<li>
<a href="/playground/" class={{ active: pathname.startsWith('/playground') }}>
<span>Playground</span>
</a>
</li>
<li>
<DocSearch
appId={import.meta.env.VITE_ALGOLIA_APP_ID}
apiKey={import.meta.env.VITE_ALGOLIA_SEARCH_KEY}
indexName={import.meta.env.VITE_ALGOLIA_INDEX}
/>
</li>
<li>
<a href="https://github.com/BuilderIO/qwik" target="_blank" title="GitHub">
<span class="md:hidden">GitHub</span>
<span class="hidden md:block">
<GithubLogo width={22} height={22} />
</span>
</a>
</li>
<li>
<a href="https://twitter.com/QwikDev" target="_blank" title="Twitter">
<span class="md:hidden">@QwikDev</span>
<span class="hidden md:block">
<TwitterLogo width={22} height={22} />
</span>
</a>
</li>
<li>
<a href="https://qwik.builder.io/chat" target="_blank" title="Discord">
<span class="md:hidden">Discord</span>
<span class="hidden md:block">
<DiscordLogo width={22} height={22} />
</span>
</a>
</li>
</ul>
</div>
</header>
);
});