返回 DeepSeek-Reasonix
SiteHeader.astro
根目录 / site / src / components / SiteHeader.astro
1 ---
2 type ActiveItem = 'features' | 'surfaces' | 'skills' | 'community' | 'docs' | 'changelog';
3
4 const {
5 active,
6 scrolled = false,
7 accountSlot = false,
8 } = Astro.props as {
9 active?: ActiveItem;
10 scrolled?: boolean;
11 accountSlot?: boolean;
12 };
13
14 const base = import.meta.env.BASE_URL.replace(/\/$/, '');
15 const repo = 'https://github.com/esengine/DeepSeek-Reasonix';
16 const items: Array<{
17 id: ActiveItem;
18 href: string;
19 en: string;
20 zh: string;
21 secondary?: boolean;
22 }> = [
23 { id: 'features', href: `${base}/#features`, en: 'Features', zh: '特性' },
24 { id: 'surfaces', href: `${base}/#surfaces`, en: 'Surfaces', zh: '使用形态', secondary: true },
25 { id: 'skills', href: `${base}/skills/`, en: 'Skills', zh: '技能市场' },
26 { id: 'community', href: `${base}/#community`, en: 'Community', zh: '社区', secondary: true },
27 { id: 'docs', href: `${base}/docs/`, en: 'Docs', zh: '文档' },
28 { id: 'changelog', href: `${base}/changelog/`, en: 'Changelog', zh: '更新日志' },
29 ];
30 ---
31
32 <header class:list={['nav', { scrolled }]}>
33 <div class="nav-inner">
34 <a class="brand" href={`${base}/`}>
35 <img src={`${base}/logo.svg`} alt="Reasonix logo" />
36 <span>Reasonix</span>
37 </a>
38 <nav class="nav-links" aria-label="Primary navigation">
39 {items.map((item) => (
40 <a
41 class:list={[{ here: active === item.id, 'nav-link--secondary': item.secondary }]}
42 href={item.href}
43 aria-current={active === item.id ? 'page' : undefined}
44 >
45 <span class="l-en">{item.en}</span>
46 <span class="l-zh">{item.zh}</span>
47 </a>
48 ))}
49 </nav>
50 <a
51 class="nav-github"
52 href={repo}
53 target="_blank"
54 rel="noreferrer"
55 aria-label="Reasonix GitHub repository"
56 >
57 <svg viewBox="0 0 24 24" aria-hidden="true">
58 <path fill="currentColor" d="M12 .7a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.3c-3.3.7-4-1.4-4-1.4-.5-1.4-1.3-1.8-1.3-1.8-1.1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.8-1.6-2.6-.3-5.4-1.3-5.4-5.9 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.7 1.6.3 2.8.1 3.1.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.4 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .7Z" />
59 </svg>
60 <span class="nav-github-label">GitHub</span>
61 </a>
62 <div class="lang-switch" role="group" aria-label="Language">
63 <button type="button" data-lang="en" class="active">EN</button>
64 <button type="button" data-lang="zh">中文</button>
65 </div>
66 <div class="theme-switch" role="group" aria-label="Theme">
67 <button type="button" data-theme="system" class="active" aria-label="System theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg></button>
68 <button type="button" data-theme="light" aria-label="Light theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"/><line x1="12" y1="1" x2="12" y2="4"/><line x1="12" y1="20" x2="12" y2="23"/><line x1="4.2" y1="4.2" x2="6.3" y2="6.3"/><line x1="17.7" y1="17.7" x2="19.8" y2="19.8"/><line x1="1" y1="12" x2="4" y2="12"/><line x1="20" y1="12" x2="23" y2="12"/><line x1="4.2" y1="19.8" x2="6.3" y2="17.7"/><line x1="17.7" y1="6.3" x2="19.8" y2="4.2"/></svg></button>
69 <button type="button" data-theme="dark" aria-label="Dark theme"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg></button>
70 </div>
71 {accountSlot ? (
72 <span class="nav-acct" data-account-slot></span>
73 ) : (
74 <a class="btn btn-ghost nav-sign-in" href={`${base}/login/`}>
75 <span class="l-en">Sign in</span>
76 <span class="l-zh">登录</span>
77 </a>
78 )}
79 <a class="btn btn-dark nav-install" href={`${base}/#start`}>
80 <span class="l-en">Install</span>
81 <span class="l-zh">安装</span>
82 </a>
83 </div>
84 </header>
85
85 lines Plain Text