This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
Files
scoresaber-reloadedv3/src/components/navbar/navbar.tsx

58 lines
1.5 KiB
TypeScript
Raw Normal View History

import { HomeIcon } from "@heroicons/react/24/solid";
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
2024-09-08 22:35:32 +01:00
import Link from "next/link";
import React from "react";
import NavbarButton from "./navbar-button";
import ProfileButton from "./profile-button";
2024-09-08 22:35:32 +01:00
type NavbarItem = {
name: string;
link: string;
icon: React.ReactNode;
};
const items: NavbarItem[] = [
{
name: "Home",
link: "/",
icon: <HomeIcon className="h-5 w-5" />, // Add your home icon here
2024-09-08 22:35:32 +01:00
},
{
name: "Search",
link: "/search",
icon: <MagnifyingGlassIcon className="h-5 w-5" />, // Add your search icon here
2024-09-08 22:35:32 +01:00
},
];
// Helper function to render each navbar item
const renderNavbarItem = (item: NavbarItem) => (
<div className="flex items-center">
{item.icon && <div className="mr-2">{item.icon}</div>}
<div>{item.name}</div>
</div>
);
export default function Navbar() {
return (
2024-09-09 09:24:16 +01:00
<div className="w-full py-2">
2024-09-11 15:38:04 +01:00
<div className="h-10 rounded-md items-center flex justify-between bg-secondary/90">
2024-09-08 22:35:32 +01:00
{/* Left-aligned items */}
<div className="flex items-center h-full">
<ProfileButton />
2024-09-08 22:35:32 +01:00
{items.slice(0, -1).map((item, index) => (
<NavbarButton key={index}>
2024-09-08 22:35:32 +01:00
<Link href={item.link}>{renderNavbarItem(item)}</Link>
</NavbarButton>
2024-09-08 22:35:32 +01:00
))}
</div>
{/* Right-aligned item */}
<NavbarButton>
2024-09-08 22:35:32 +01:00
<Link href={items[items.length - 1].link}>{renderNavbarItem(items[items.length - 1])}</Link>
</NavbarButton>
2024-09-08 22:35:32 +01:00
</div>
</div>
);
}