2024-09-09 12:08:24 +01:00
|
|
|
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";
|
2024-09-09 12:08:24 +01:00
|
|
|
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: "/",
|
2024-09-09 12:08:24 +01:00
|
|
|
icon: <HomeIcon className="h-5 w-5" />, // Add your home icon here
|
2024-09-08 22:35:32 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name: "Search",
|
|
|
|
link: "/search",
|
2024-09-09 12:08:24 +01:00
|
|
|
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-09 12:08:24 +01:00
|
|
|
<div className="h-10 rounded-md items-center flex justify-between bg-secondary">
|
2024-09-08 22:35:32 +01:00
|
|
|
{/* Left-aligned items */}
|
2024-09-09 12:08:24 +01:00
|
|
|
<div className="flex items-center h-full">
|
|
|
|
<ProfileButton />
|
|
|
|
|
2024-09-08 22:35:32 +01:00
|
|
|
{items.slice(0, -1).map((item, index) => (
|
2024-09-09 12:08:24 +01:00
|
|
|
<NavbarButton key={index}>
|
2024-09-08 22:35:32 +01:00
|
|
|
<Link href={item.link}>{renderNavbarItem(item)}</Link>
|
2024-09-09 12:08:24 +01:00
|
|
|
</NavbarButton>
|
2024-09-08 22:35:32 +01:00
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* Right-aligned item */}
|
2024-09-09 12:08:24 +01:00
|
|
|
<NavbarButton>
|
2024-09-08 22:35:32 +01:00
|
|
|
<Link href={items[items.length - 1].link}>{renderNavbarItem(items[items.length - 1])}</Link>
|
2024-09-09 12:08:24 +01:00
|
|
|
</NavbarButton>
|
2024-09-08 22:35:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|