Spaces:
Running
Running
| 'use client'; | |
| import Link from 'next/link'; | |
| import { usePathname } from 'next/navigation'; | |
| interface NavItem { | |
| href: string; | |
| label: string; | |
| icon: string; | |
| } | |
| const NAV_ITEMS: NavItem[] = [ | |
| { href: '/', label: 'Dashboard', icon: 'β‘' }, | |
| { href: '/create', label: 'Create', icon: 'β¨' }, | |
| { href: '/schedule', label: 'Schedule', icon: 'π ' }, | |
| { href: '/analytics', label: 'Analytics', icon: 'π' }, | |
| { href: '/settings', label: 'Settings', icon: 'βοΈ' }, | |
| ]; | |
| export default function Sidebar(): React.ReactElement { | |
| const pathname = usePathname(); | |
| return ( | |
| <aside className="w-56 min-h-screen bg-gray-900 text-white flex flex-col"> | |
| <div className="px-6 py-5 border-b border-gray-700"> | |
| <span className="font-bold text-lg tracking-tight">CarouselForge</span> | |
| </div> | |
| <nav className="flex-1 px-3 py-4 space-y-1"> | |
| {NAV_ITEMS.map((item) => { | |
| const isActive = pathname === item.href; | |
| return ( | |
| <Link | |
| key={item.href} | |
| href={item.href} | |
| className={`flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors ${ | |
| isActive | |
| ? 'bg-blue-600 text-white' | |
| : 'text-gray-300 hover:bg-gray-800 hover:text-white' | |
| }`} | |
| > | |
| <span>{item.icon}</span> | |
| <span>{item.label}</span> | |
| </Link> | |
| ); | |
| })} | |
| </nav> | |
| </aside> | |
| ); | |
| } | |