"use client"; import React from "react"; import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, } from "@/components/ui/breadcrumb"; import { Home } from "lucide-react"; import { usePathname } from "next/navigation"; export const Navbar = () => { const pathname = usePathname(); const pathSegments = pathname.split("/").filter(Boolean); // Filter out empty strings return ( {/* If pathname is "/", display the Home icon inside BreadcrumbPage */} {pathSegments.length === 0 ? ( ) : ( <> {/* Always show Home as the first BreadcrumbLink */} {pathSegments.map((item, index) => ( {index === pathSegments.length - 1 ? ( {item} ) : ( {item} )} {index !== pathSegments.length - 1 && } ))} )} ); };