Files
todomonitor/frontend/src/components/layout/TopNav.vue
T

118 lines
2.8 KiB
Vue

<script setup lang="ts">
import { useUiStore } from '@/stores/ui'
const ui = useUiStore()
</script>
<template>
<nav class="top-nav">
<div class="nav-left">
<div class="logo">
<svg width="22" height="22" viewBox="0 0 32 32" fill="none">
<rect width="32" height="32" rx="7" :fill="'var(--accent)'" />
<path d="M9 16.5L14 21.5L23 11.5" stroke="white" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<span class="logo-text">Todo Monitor</span>
</div>
</div>
<div class="nav-center">
<div class="view-switcher">
<button
class="switcher-btn"
:class="{ active: ui.viewMode === 'dashboard' }"
@click="ui.setViewMode('dashboard')"
>
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="7" height="7" rx="1" />
<rect x="14" y="3" width="7" height="7" rx="1" />
<rect x="3" y="14" width="7" height="7" rx="1" />
<rect x="14" y="14" width="7" height="7" rx="1" />
</svg>
大屏
</button>
<button
class="switcher-btn"
:class="{ active: ui.viewMode === 'canvas' }"
@click="ui.setViewMode('canvas')"
>
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2" />
<line x1="3" y1="9" x2="21" y2="9" />
<line x1="9" y1="3" x2="9" y2="21" />
</svg>
画布
</button>
</div>
</div>
<div class="nav-right" />
</nav>
</template>
<style scoped>
.top-nav {
height: var(--nav-height);
background: var(--bg-nav);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
border-bottom: 1px solid var(--border-dashboard);
z-index: 100;
flex-shrink: 0;
user-select: none;
}
.nav-left {
display: flex;
align-items: center;
gap: 12px;
}
.logo {
display: flex;
align-items: center;
gap: 10px;
}
.logo-text {
font-size: 15px;
font-weight: 600;
letter-spacing: -0.01em;
color: var(--text-primary);
}
.view-switcher {
display: flex;
background: rgba(255, 255, 255, 0.04);
border-radius: var(--radius-sm);
padding: 3px;
gap: 2px;
}
.switcher-btn {
display: flex;
align-items: center;
gap: 6px;
padding: 5px 14px;
border-radius: 4px;
font-size: 13px;
font-weight: 500;
color: var(--text-secondary);
transition: all 0.18s ease;
}
.switcher-btn:hover {
color: var(--text-primary);
}
.switcher-btn.active {
background: rgba(255, 255, 255, 0.08);
color: var(--text-primary);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.nav-right {
width: 100px;
}
</style>