diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx new file mode 100644 index 0000000..05314c9 --- /dev/null +++ b/src/components/navbar.tsx @@ -0,0 +1,62 @@ +"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 && } + + ))} + + )} + + + ); +};