64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import Link from "next/link";
|
|
import { usePathname } from "next/navigation";
|
|
import {
|
|
LayoutDashboard,
|
|
FileText,
|
|
Users,
|
|
Tags,
|
|
Heart,
|
|
Settings,
|
|
Landmark,
|
|
} from "lucide-react";
|
|
import { cn } from "@/lib/utils";
|
|
import { ThemeToggle } from "./ThemeToggle";
|
|
|
|
const NAV = [
|
|
{ href: "/", label: "Dashboard", icon: LayoutDashboard },
|
|
{ href: "/bills", label: "Bills", icon: FileText },
|
|
{ href: "/members", label: "Members", icon: Users },
|
|
{ href: "/topics", label: "Topics", icon: Tags },
|
|
{ href: "/following", label: "Following", icon: Heart },
|
|
{ href: "/settings", label: "Settings", icon: Settings },
|
|
];
|
|
|
|
export function Sidebar() {
|
|
const pathname = usePathname();
|
|
|
|
return (
|
|
<aside className="w-56 shrink-0 border-r border-border bg-card flex flex-col">
|
|
<div className="p-4 border-b border-border flex items-center gap-2">
|
|
<Landmark className="w-5 h-5 text-primary" />
|
|
<span className="font-semibold text-sm">PocketVeto</span>
|
|
</div>
|
|
|
|
<nav className="flex-1 p-3 space-y-1">
|
|
{NAV.map(({ href, label, icon: Icon }) => {
|
|
const active = href === "/" ? pathname === "/" : pathname.startsWith(href);
|
|
return (
|
|
<Link
|
|
key={href}
|
|
href={href}
|
|
className={cn(
|
|
"flex items-center gap-3 px-3 py-2 rounded-md text-sm transition-colors",
|
|
active
|
|
? "bg-primary text-primary-foreground"
|
|
: "text-muted-foreground hover:bg-accent hover:text-accent-foreground"
|
|
)}
|
|
>
|
|
<Icon className="w-4 h-4 shrink-0" />
|
|
{label}
|
|
</Link>
|
|
);
|
|
})}
|
|
</nav>
|
|
|
|
<div className="p-3 border-t border-border flex items-center justify-between">
|
|
<span className="text-xs text-muted-foreground">Theme</span>
|
|
<ThemeToggle />
|
|
</div>
|
|
</aside>
|
|
);
|
|
}
|