-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSiteHeader.astro
More file actions
37 lines (35 loc) · 1.07 KB
/
Copy pathSiteHeader.astro
File metadata and controls
37 lines (35 loc) · 1.07 KB
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
---
import { primaryNav, site } from "../data/site";
const { currentPath = "/" } = Astro.props;
const isCurrent = (href: string) =>
href === "/" ? currentPath === href : currentPath.startsWith(href);
---
<a class="skip-link" href="#content">跳到正文</a>
<header class="site-header site-shell">
<p class="mast-line">Shanghai · Product & systems · Updated 2026</p>
<a class="mast-name" href="/" aria-label={`${site.name} 首页`}>{site.handle}</a>
<nav class="desktop-nav" aria-label="主要导航">
<ul>
{primaryNav.map((item) => (
<li>
<a href={item.href} aria-current={isCurrent(item.href) ? "page" : undefined}>
{item.label}
</a>
</li>
))}
</ul>
</nav>
<details class="mobile-nav">
<summary>Menu</summary>
<ul>
{primaryNav.map((item) => (
<li>
<a href={item.href} aria-current={isCurrent(item.href) ? "page" : undefined}>
{item.label}
</a>
</li>
))}
</ul>
</details>
<hr class="mast-rule" aria-hidden="true" />
</header>