mirror of
https://github.com/zoo-apps/network.git
synced 2026-10-30 14:56:38 +00:00
74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
'use client'
|
|
|
|
import Link from 'next/link'
|
|
import { usePathname } from 'next/navigation'
|
|
import { cn } from '@/lib/utils'
|
|
import {
|
|
Home,
|
|
Blocks,
|
|
Activity,
|
|
Users,
|
|
FileCode,
|
|
Settings,
|
|
Moon,
|
|
Sun
|
|
} from 'lucide-react'
|
|
import { useTheme } from 'next-themes'
|
|
import { Button } from './ui/button'
|
|
|
|
const navItems = [
|
|
{ href: '/', label: 'Home', icon: Home },
|
|
{ href: '/blocks', label: 'Blocks', icon: Blocks },
|
|
{ href: '/transactions', label: 'Transactions', icon: Activity },
|
|
{ href: '/accounts', label: 'Accounts', icon: Users },
|
|
{ href: '/contracts', label: 'Contracts', icon: FileCode },
|
|
]
|
|
|
|
export function Navigation() {
|
|
const pathname = usePathname()
|
|
const { theme, setTheme } = useTheme()
|
|
|
|
return (
|
|
<header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
|
<div className="container flex h-16 items-center">
|
|
<div className="mr-4 flex">
|
|
<Link href="/" className="mr-6 flex items-center space-x-2">
|
|
<span className="font-bold text-xl">ZOO</span>
|
|
<span className="text-muted-foreground">Explorer</span>
|
|
</Link>
|
|
<nav className="flex items-center space-x-4 sm:space-x-6 text-sm font-medium">
|
|
{navItems.map((item) => {
|
|
const Icon = item.icon
|
|
return (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
className={cn(
|
|
"flex items-center gap-2 transition-colors hover:text-foreground/80",
|
|
pathname === item.href
|
|
? "text-foreground"
|
|
: "text-foreground/60"
|
|
)}
|
|
>
|
|
<Icon className="h-4 w-4" />
|
|
<span className="hidden lg:inline">{item.label}</span>
|
|
</Link>
|
|
)
|
|
})}
|
|
</nav>
|
|
</div>
|
|
<div className="ml-auto flex items-center space-x-4">
|
|
<Button
|
|
variant="ghost"
|
|
size="icon"
|
|
onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}
|
|
>
|
|
<Sun className="h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
|
|
<Moon className="absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
|
|
<span className="sr-only">Toggle theme</span>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
)
|
|
} |