-
Notifications
You must be signed in to change notification settings - Fork 295
Expand file tree
/
Copy pathHeader.vue
More file actions
56 lines (51 loc) · 2.63 KB
/
Header.vue
File metadata and controls
56 lines (51 loc) · 2.63 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<script setup>
import { RouterLink, useRoute } from 'vue-router'
import { useThemeStore } from '../stores/theme'
const themeStore = useThemeStore()
const route = useRoute()
</script>
<template>
<header class="fixed top-0 right-0 left-0 lg:left-64 z-30 bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 h-16 flex items-center justify-between px-4 lg:px-6">
<div class="flex items-center gap-4">
<!-- Mobile menu button -->
<button
@click="themeStore.toggleSidebar"
class="lg:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700"
>
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
<!-- Page title -->
<h2 class="text-lg font-semibold text-gray-900 dark:text-gray-100">
{{ route.meta.title || 'DRPY Node Admin' }}
</h2>
</div>
<div class="flex items-center gap-3">
<!-- Theme toggle -->
<button
@click="themeStore.toggleTheme"
class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors"
:title="themeStore.isDark ? '切换到亮色模式' : '切换到暗色模式'"
>
<svg v-if="themeStore.isDark" class="w-5 h-5 text-yellow-500" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z" clip-rule="evenodd" />
</svg>
<svg v-else class="w-5 h-5 text-gray-700" fill="currentColor" viewBox="0 0 20 20">
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
</svg>
</button>
<!-- External link -->
<a
href="/"
target="_blank"
class="hidden sm:flex btn btn-secondary text-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
</svg>
主页
</a>
</div>
</header>
</template>