-
Notifications
You must be signed in to change notification settings - Fork 69
/
Navbar.astro
107 lines (94 loc) · 3.18 KB
/
Navbar.astro
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
---
import Link from "./Link.astro";
import { site } from "../site";
import { Icon } from "astro-icon/components";
import DrawerToggler from "./DrawerToggler.astro";
import HorizontalContainer from "./HorizontalContainer.astro";
import ThemeSwitcher from "./ThemeSwitcher.astro";
import Dropdown from "./Dropdown.astro";
import { getCollection } from "astro:content";
import { conceptPagePath, startPagePath } from "../lib/utils";
import Drawer from "./Drawer.astro";
const { title, githubUrl, navbarLinks } = site;
const startPages = (await getCollection("start")).map(
({ slug, data: { title } }) => {
return { title, href: startPagePath(slug) };
},
);
const conceptPages = (await getCollection("concepts")).map(
({ slug, data: { title } }) => {
return { title, href: conceptPagePath(slug) };
},
);
---
<nav
class="sticky top-0 z-10 bg-white py-2 shadow-sm shadow-light-gray dark:bg-dark dark:shadow-dark-gray md:py-2.5 lg:py-3"
>
<HorizontalContainer>
<div class="flex items-center justify-between">
{/* Navbar "brand" */}
<div class="flex items-center space-x-2 md:space-x-3 lg:space-x-4">
<Link
href="/"
class="text-2xl font-semibold tracking-tight duration-hover hover:text-primary dark:hover:text-light-gray md:text-3xl lg:text-4xl"
>
{title}
</Link>
<span
class="flex items-center space-x-1.5 text-sm font-light md:text-base lg:text-lg"
>
<span>from</span>
<Link
href="https://determinate.systems"
class="font-semibold duration-hover hover:text-primary dark:hover:text-light-blue"
target="_blank"
>
Determinate Systems
</Link>
</span>
</div>
{/* Visible only on mobile */}
<div class="flex items-center space-x-4 md:hidden">
<ThemeSwitcher />
<Link href={githubUrl} target="_blank">
<Icon
name="radix-icons:github-logo"
class="size-4 transition duration-hover hover:text-gray dark:hover:text-light-gray md:size-5 lg:size-6"
/>
</Link>
<DrawerToggler />
</div>
{/* Show only on md or above (invisible on mobile) */}
<ul class="hidden items-center gap-4 md:flex md:gap-5 lg:gap-6">
<li>
<Dropdown text="Quick start" pages={startPages} ordered />
</li>
<li>
<Dropdown text="Concepts" pages={conceptPages} />
</li>
{
navbarLinks.map(({ text, href }) => (
<li>
<Link
{href}
class="text-sm duration-hover hover:text-primary md:text-base lg:text-lg"
>
{text}
</Link>
</li>
))
}
<li class="flex items-center space-x-2 md:space-x-3 lg:space-x-4">
<ThemeSwitcher />
<Link href={githubUrl} target="_blank">
<Icon
name="radix-icons:github-logo"
class="size-4 duration-hover hover:text-gray dark:hover:text-light-gray md:size-5 lg:size-6"
/>
</Link>
</li>
</ul>
</div>
</HorizontalContainer>
</nav>
<Drawer />