import { CogIcon, HomeIcon } from "@heroicons/react/24/solid"; import { MagnifyingGlassIcon } from "@radix-ui/react-icons"; import Link from "next/link"; import React from "react"; import NavbarButton from "./navbar-button"; import ProfileButton from "./profile-button"; import { SwordIcon, TrendingUpIcon } from "lucide-react"; type NavbarItem = { name: string; link: string; align: "left" | "right"; icon: React.ReactNode; }; const items: NavbarItem[] = [ { name: "Home", link: "/", align: "left", icon: , }, { name: "Ranking", link: "/ranking", align: "left", icon: , }, { name: "Score Feed", link: "/scores", align: "left", icon: , }, { name: "Search", link: "/search", align: "right", icon: , }, { name: "Settings", link: "/settings", align: "right", icon: , }, ]; // Helper function to render each navbar item const renderNavbarItem = (item: NavbarItem) => (
{item.icon &&
{item.icon}
}

{item.name}

); export default function Navbar() { const rightItems = items.filter(item => item.align === "right"); const leftItems = items.filter(item => item.align === "left"); return (
{/* Left-aligned items */}
{leftItems.map((item, index) => ( {renderNavbarItem(item)} ))}
{/* Right-aligned items */}
{rightItems.map((item, index) => ( {renderNavbarItem(item)} ))}
); }