Skip to content

Commit 90a5de5

Browse files
committed
feat: align NavBar logo with SideBar width and nav items with divider
1 parent 2e4d770 commit 90a5de5

1 file changed

Lines changed: 39 additions & 86 deletions

File tree

src/components/NavBar.vue

Lines changed: 39 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,28 @@ function isActive(path: string): boolean {
2020
</script>
2121

2222
<template>
23-
<nav class="fixed top-0 left-0 right-0 z-50 border-b border-white/10 bg-surface/80 backdrop-blur-md">
24-
<div class="mx-auto flex h-14 max-w-7xl items-center justify-between px-6">
25-
<!-- Logo -->
26-
<router-link to="/" class="flex items-center group shrink-0">
27-
<svg width="134" height="30" viewBox="0 0 134 30" fill="none" class="transition-opacity group-hover:opacity-80">
28-
<!-- 左 ZZzz:大到小渐弱 -->
29-
<text x="0" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa">Z</text>
30-
<text x="14" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa" opacity="0.9">Z</text>
31-
<text x="28" y="22" font-family="monospace" font-size="15" fill="#60a5fa" opacity="0.65">z</text>
32-
<text x="39" y="20" font-family="monospace" font-size="12" fill="#60a5fa" opacity="0.45">z</text>
33-
<!-- 中间 sws:与两侧小 z 齐平 -->
34-
<text x="49" y="20" font-family="monospace" font-size="11" fill="#3b82f6" opacity="0.38">s</text>
35-
<text x="59" y="20" font-family="monospace" font-size="13" fill="#3b82f6" opacity="0.42">w</text>
36-
<text x="73" y="20" font-family="monospace" font-size="11" fill="#3b82f6" opacity="0.38">s</text>
37-
<!-- 右 zzZZ:小到大渐强 -->
38-
<text x="83" y="20" font-family="monospace" font-size="12" fill="#60a5fa" opacity="0.45">z</text>
39-
<text x="94" y="22" font-family="monospace" font-size="15" fill="#60a5fa" opacity="0.65">z</text>
40-
<text x="105" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa" opacity="0.9">Z</text>
41-
<text x="119" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa">Z</text>
42-
</svg>
43-
</router-link>
23+
<nav class="fixed top-0 left-0 right-0 z-50 flex h-14 items-center border-b border-white/10 bg-surface/80 backdrop-blur-md">
24+
<!-- 左侧 Logo 区域:w-64 与 SideBar 对齐 -->
25+
<router-link to="/" class="flex h-14 w-64 shrink-0 items-center px-6 group">
26+
<svg width="134" height="30" viewBox="0 0 134 30" fill="none" class="transition-opacity group-hover:opacity-80">
27+
<text x="0" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa">Z</text>
28+
<text x="14" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa" opacity="0.9">Z</text>
29+
<text x="28" y="22" font-family="monospace" font-size="15" fill="#60a5fa" opacity="0.65">z</text>
30+
<text x="39" y="20" font-family="monospace" font-size="12" fill="#60a5fa" opacity="0.45">z</text>
31+
<text x="49" y="20" font-family="monospace" font-size="11" fill="#3b82f6" opacity="0.38">s</text>
32+
<text x="59" y="20" font-family="monospace" font-size="13" fill="#3b82f6" opacity="0.42">w</text>
33+
<text x="73" y="20" font-family="monospace" font-size="11" fill="#3b82f6" opacity="0.38">s</text>
34+
<text x="83" y="20" font-family="monospace" font-size="12" fill="#60a5fa" opacity="0.45">z</text>
35+
<text x="94" y="22" font-family="monospace" font-size="15" fill="#60a5fa" opacity="0.65">z</text>
36+
<text x="105" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa" opacity="0.9">Z</text>
37+
<text x="119" y="24" font-family="monospace" font-size="20" font-weight="bold" fill="#60a5fa">Z</text>
38+
</svg>
39+
</router-link>
4440

45-
<!-- Desktop Nav -->
46-
<div class="hidden items-center gap-1 md:flex">
47-
<router-link
48-
to="/about"
49-
class="rounded-md px-3 py-1.5 text-sm text-gray-400 hover:bg-white/5 hover:text-gray-200 transition-colors"
50-
>
41+
<!-- 右侧:导航菜单 + 图标(从 SideBar 分割线位置开始) -->
42+
<div class="hidden flex-1 items-center justify-between pr-6 md:flex">
43+
<div class="flex items-center gap-1">
44+
<router-link to="/about" class="rounded-md px-3 py-1.5 text-sm text-gray-400 hover:bg-white/5 hover:text-gray-200 transition-colors">
5145
个人介绍
5246
</router-link>
5347

@@ -62,11 +56,7 @@ function isActive(path: string): boolean {
6256
<path stroke-linecap="round" stroke-linejoin="round" d="M19 9l-7 7-7-7" />
6357
</svg>
6458
</button>
65-
<div
66-
v-show="projectDropdownOpen"
67-
class="absolute left-0 top-[calc(100%-4px)] z-10"
68-
@mouseenter="projectDropdownOpen = true"
69-
>
59+
<div v-show="projectDropdownOpen" class="absolute left-0 top-[calc(100%-4px)] z-10" @mouseenter="projectDropdownOpen = true">
7060
<div class="h-1 w-full" />
7161
<div class="w-56 rounded-lg border border-white/10 bg-surface-50 py-1 shadow-xl">
7262
<router-link
@@ -82,75 +72,38 @@ function isActive(path: string): boolean {
8272
</div>
8373
</div>
8474

85-
<router-link
86-
to="/social"
87-
class="rounded-md px-3 py-1.5 text-sm text-gray-400 hover:bg-white/5 hover:text-gray-200 transition-colors"
88-
>
75+
<router-link to="/social" class="rounded-md px-3 py-1.5 text-sm text-gray-400 hover:bg-white/5 hover:text-gray-200 transition-colors">
8976
社交平台
9077
</router-link>
9178
</div>
9279

93-
<!-- Right icons -->
9480
<div class="flex items-center gap-3">
95-
<a
96-
href="https://github.com/zhushanwen321"
97-
target="_blank"
98-
rel="noopener"
99-
class="text-gray-500 hover:text-gray-300 transition-colors"
100-
aria-label="GitHub"
101-
>
102-
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
103-
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
104-
</svg>
81+
<a href="https://github.com/zhushanwen321" target="_blank" rel="noopener" class="text-gray-500 hover:text-gray-300 transition-colors" aria-label="GitHub">
82+
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/></svg>
10583
</a>
106-
<a
107-
href="https://gitee.com/zzzzswszzzz"
108-
target="_blank"
109-
rel="noopener"
110-
class="text-gray-500 hover:text-gray-300 transition-colors"
111-
aria-label="Gitee"
112-
>
113-
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 24 24">
114-
<path d="M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.926c0 .327.266.592.593.592h5.926c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.149a.592.592 0 0 1-.592-.592v-1.482a.592.592 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H8.37a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h5.85z"/>
115-
</svg>
84+
<a href="https://gitee.com/zzzzswszzzz" target="_blank" rel="noopener" class="text-gray-500 hover:text-gray-300 transition-colors" aria-label="Gitee">
85+
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 24 24"><path d="M11.984 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.016 0zm6.09 5.333c.328 0 .593.266.592.593v1.482a.594.594 0 0 1-.593.592H9.777c-.982 0-1.778.796-1.778 1.778v5.926c0 .327.266.592.593.592h5.926c.982 0 1.778-.796 1.778-1.778v-.296a.593.593 0 0 0-.592-.593h-4.149a.592.592 0 0 1-.592-.592v-1.482a.592.592 0 0 1 .593-.592h6.815c.327 0 .593.265.593.592v3.408a4 4 0 0 1-4 4H8.37a.593.593 0 0 1-.593-.593V9.778a4.444 4.444 0 0 1 4.445-4.444h5.85z"/></svg>
11686
</a>
117-
118-
<button
119-
class="md:hidden text-gray-400 hover:text-gray-200 transition-colors"
120-
@click="toggleMobile"
121-
aria-label="Toggle menu"
122-
>
123-
<svg v-if="!mobileOpen" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
124-
<path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" />
125-
</svg>
126-
<svg v-else class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
127-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
128-
</svg>
129-
</button>
13087
</div>
13188
</div>
13289

90+
<!-- Mobile hamburger -->
91+
<div class="flex flex-1 items-center justify-end pr-6 md:hidden">
92+
<button class="text-gray-400 hover:text-gray-200 transition-colors" @click="toggleMobile" aria-label="Toggle menu">
93+
<svg v-if="!mobileOpen" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M4 6h16M4 12h16M4 18h16" /></svg>
94+
<svg v-else class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
95+
</button>
96+
</div>
97+
13398
<!-- Mobile menu -->
134-
<div v-show="mobileOpen" class="border-t border-white/10 md:hidden">
99+
<div v-show="mobileOpen" class="absolute left-0 right-0 top-14 border-t border-white/10 md:hidden">
135100
<div class="space-y-1 px-4 py-3">
136-
<router-link to="/about" class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5" @click="mobileOpen = false">
137-
个人介绍
138-
</router-link>
101+
<router-link to="/about" class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5" @click="mobileOpen = false">个人介绍</router-link>
139102
<div class="pl-3">
140103
<p class="px-3 py-1 text-xs font-semibold uppercase tracking-wider text-gray-500">项目介绍</p>
141-
<router-link
142-
v-for="project in projects"
143-
:key="project.path"
144-
:to="project.path"
145-
class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5"
146-
@click="mobileOpen = false"
147-
>
148-
{{ project.name }}
149-
</router-link>
104+
<router-link v-for="project in projects" :key="project.path" :to="project.path" class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5" @click="mobileOpen = false">{{ project.name }}</router-link>
150105
</div>
151-
<router-link to="/social" class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5" @click="mobileOpen = false">
152-
社交平台
153-
</router-link>
106+
<router-link to="/social" class="block rounded-md px-3 py-2 text-sm text-gray-300 hover:bg-white/5" @click="mobileOpen = false">社交平台</router-link>
154107
</div>
155108
</div>
156109
</nav>

0 commit comments

Comments
 (0)