import Link from 'next/link'
import { usePathname } from 'next/navigation'

const menuItems = [
  { href: '/', label: 'Главная' },
  { href: '/publications', label: 'Новости и публикации' },
  { href: '/rid', label: 'РИД' },
  { href: '/staff', label: 'Сотрудники' },
  { href: '/projects', label: 'Проекты' },
  { href: '/students', label: 'Студентам' },
  { href: '/contacts', label: 'Контакты' },
]

export default function Sidebar() {
  const pathname = usePathname()

  return (
    <aside className="w-64 bg-white shadow-sm border-r min-h-screen">
      <div className="p-6">
        <Link href="/" className="text-xl font-bold text-gray-900 block mb-8">
          Отдел Радиофотоники
        </Link>
        <nav className="space-y-2">
          {menuItems.map((item) => {
            const isActive = pathname === item.href
            return (
              <Link
                key={item.href}
                href={item.href}
                className={`block px-4 py-3 rounded-lg text-sm font-medium transition-colors ${
                  isActive
                    ? 'bg-blue-50 text-blue-700 border-l-4 border-blue-700'
                    : 'text-gray-700 hover:bg-gray-50 hover:text-blue-600'
                }`}
              >
                {item.label}
              </Link>
            )
          })}
        </nav>
      </div>
    </aside>
  )
}