细化导航栏样式

This commit is contained in:
2025-10-21 13:44:29 +08:00
parent 80310f710c
commit 9df17211a5
2 changed files with 25 additions and 7 deletions

View File

@@ -3,7 +3,7 @@
import { ReactNode, useState } from 'react' import { ReactNode, useState } from 'react'
import { useRouter, usePathname } from 'next/navigation' import { useRouter, usePathname } from 'next/navigation'
import { logout } from '@/actions/auth' import { logout } from '@/actions/auth'
import { LogOutIcon } from 'lucide-react' import { LayoutDashboardIcon, LogOutIcon, User2Icon } from 'lucide-react'
import Link from 'next/link' import Link from 'next/link'
import { cn } from '@/lib/utils' import { cn } from '@/lib/utils'
import { DoorClosedIcon } from 'lucide-react' import { DoorClosedIcon } from 'lucide-react'
@@ -70,14 +70,18 @@ export default function DashboardLayout({
{/* 主要内容区域 */} {/* 主要内容区域 */}
<div className="flex-auto overflow-hidden flex"> <div className="flex-auto overflow-hidden flex">
{/* 侧边栏 */} {/* 侧边栏 */}
<nav className="flex-none basis-64 border-r flex flex-col p-3 gap-2"> <nav className="flex-none basis-64 border-r flex flex-col p-3">
<NavbarItem href="/gatewayinfo" active={isActive('/gatewayinfo')}><DoorClosedIcon size={20} /></NavbarItem> <NavbarTitle></NavbarTitle>
<NavbarItem href="/gatewayConfig" active={isActive('/gatewayConfig')}><DoorClosedLockedIcon size={20} /></NavbarItem>
<NavbarItem href="/gatewayMonitor" active={isActive('/gatewayMonitor')}><DoorOpenIcon size={20} /></NavbarItem>
<NavbarItem href="/cityNodeStats" active={isActive('/cityNodeStats')}><MapPinnedIcon size={20} /></NavbarItem> <NavbarItem href="/cityNodeStats" active={isActive('/cityNodeStats')}><MapPinnedIcon size={20} /></NavbarItem>
<NavbarTitle></NavbarTitle>
<NavbarItem href="/gatewayinfo" active={isActive('/gatewayinfo')}><DoorClosedIcon size={20} /></NavbarItem>
<NavbarItem href="/gatewayConfig" active={isActive('/gatewayConfig')}><DoorClosedLockedIcon size={20} /></NavbarItem>
<NavbarItem href="/gatewayMonitor" active={isActive('/gatewayMonitor')}><LayoutDashboardIcon size={20} /></NavbarItem>
<NavbarTitle></NavbarTitle>
<NavbarItem href="/edge" active={isActive('/edge')}><GitForkIcon size={20} /></NavbarItem>
<NavbarItem href="/allocationStatus" active={isActive('/allocationStatus')}><ContainerIcon size={20} /></NavbarItem> <NavbarItem href="/allocationStatus" active={isActive('/allocationStatus')}><ContainerIcon size={20} /></NavbarItem>
<NavbarItem href="/edge" active={isActive('/edge')}><GitForkIcon size={20} /></NavbarItem> <NavbarTitle></NavbarTitle>
<NavbarItem href="/settings" active={isActive('/settings')}><SettingsIcon size={20} /></NavbarItem> <NavbarItem href="/settings" active={isActive('/settings')}><User2Icon size={20} /></NavbarItem>
</nav> </nav>
{/* 内容区域 */} {/* 内容区域 */}
@@ -89,6 +93,16 @@ export default function DashboardLayout({
) )
} }
function NavbarTitle(props: {
children: ReactNode
}) {
return (
<h3 className="text-sm text-weak h-8 flex items-end px-2 pb-1">
{props.children}
</h3>
)
}
function NavbarItem(props: { function NavbarItem(props: {
href: string href: string
active: boolean active: boolean

View File

@@ -6,6 +6,7 @@
@theme inline { @theme inline {
--color-background: var(--background); --color-background: var(--background);
--color-foreground: var(--foreground); --color-foreground: var(--foreground);
--color-weak: var(--weak);
--font-sans: var(--font-geist-sans); --font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono); --font-mono: var(--font-geist-mono);
--color-sidebar-ring: var(--sidebar-ring); --color-sidebar-ring: var(--sidebar-ring);
@@ -45,8 +46,11 @@
:root { :root {
--radius: 0.625rem; --radius: 0.625rem;
--background: oklch(1 0 0); --background: oklch(1 0 0);
--foreground: oklch(0.145 0 0); --foreground: oklch(0.145 0 0);
--weak: oklch(0.6 0 0);
--card: oklch(1 0 0); --card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0); --card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0); --popover: oklch(1 0 0);