/**
* @file Navbar.tsx
* @description Client component providing responsive navigation for desktop and mobile views with active route indicators.
*/
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { LayoutDashboard, FileText } from "lucide-react";
/**
* Array of navigation items containing their name, route path, and corresponding icon.
*/
const navItems = [
{ name: "Summary", href: "/summary", icon: FileText },
{ name: "Dashboard", href: "/dashboard", icon: LayoutDashboard },
];
/**
* Renders the responsive navigation bar featuring desktop sidebar layout
* and mobile bottom bar layout with active state styling.
*
* @returns {JSX.Element} The rendered navigation component.
*/
export default function Navbar() {
const pathname = usePathname();
// Shared function to render navigation links to avoid code duplication
const renderNavLinks = (isMobile = false) =>
navItems.map((item) => {
const Icon = item.icon;
const isActive =
pathname === item.href ||
(item.href !== "/" && pathname.startsWith(item.href));
return (
{item.name}
);
});
return (
<>
{/* Desktop Navigation */}
{/* Mobile Navigation */}
>
);
}