ProxMenux/web/app/components/DocSidebar.tsx

51 lines
1.6 KiB
TypeScript
Raw Normal View History

2025-02-13 20:13:54 +01:00
"use client"
2025-02-13 17:28:49 +01:00
import Link from "next/link"
import { usePathname } from "next/navigation"
2025-02-13 20:13:54 +01:00
import { useState } from "react"
import { Menu } from "lucide-react"
2025-02-13 17:28:49 +01:00
const sidebarItems = [
{ title: "Introduction", href: "/docs/introduction" },
{ title: "Installation", href: "/docs/installation" },
{ title: "Getting Started", href: "/docs/getting-started" },
{ title: "Features", href: "/docs/features" },
{ title: "API", href: "/docs/api" },
2025-02-13 20:13:54 +01:00
{ title: "Guides", href: "/guides" },
2025-02-13 17:28:49 +01:00
{ title: "FAQ", href: "/docs/faq" },
]
export default function DocSidebar() {
const pathname = usePathname()
2025-02-13 20:13:54 +01:00
const [isOpen, setIsOpen] = useState(false)
2025-02-13 17:28:49 +01:00
return (
2025-02-13 20:13:54 +01:00
<nav className="w-full md:w-64 bg-gray-100 p-4 md:p-6">
<div className="flex justify-between items-center md:block">
<h2 className="text-lg font-semibold mb-4 text-gray-900">Documentation</h2>
<button className="md:hidden" onClick={() => setIsOpen(!isOpen)}>
<Menu className="h-6 w-6" />
</button>
</div>
<ul className={`space-y-2 ${isOpen ? "block" : "hidden"} md:block`}>
2025-02-13 17:28:49 +01:00
{sidebarItems.map((item) => (
<li key={item.href}>
<Link
href={item.href}
className={`block p-2 rounded ${
2025-02-13 20:13:54 +01:00
pathname === item.href
? "bg-blue-500 text-white"
: "text-gray-700 hover:bg-gray-200 hover:text-gray-900"
2025-02-13 17:28:49 +01:00
}`}
2025-02-13 20:13:54 +01:00
onClick={() => setIsOpen(false)}
2025-02-13 17:28:49 +01:00
>
{item.title}
</Link>
</li>
))}
</ul>
</nav>
)
}