2023-10-13 19:02:59 -04:00
|
|
|
"use client";
|
|
|
|
import { useState } from "react";
|
|
|
|
import Link from "next/link";
|
|
|
|
import { cn } from "@/lib/utils";
|
2023-10-14 12:09:44 -04:00
|
|
|
import { RiMenu3Line, RiCloseFill } from "react-icons/ri";
|
|
|
|
import Logo from "@/assets/Logo";
|
2023-10-13 19:02:59 -04:00
|
|
|
export default function Header() {
|
|
|
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
|
|
const navigation = [
|
|
|
|
{ name: "home", label: "Home", href: "/" },
|
|
|
|
{ name: "explore", label: "Explore", href: "/" },
|
|
|
|
{ name: "about", label: "About", href: "/" },
|
|
|
|
{ name: "contact", label: "Contact", href: "/" },
|
|
|
|
];
|
|
|
|
return (
|
|
|
|
<header
|
|
|
|
className={cn(
|
|
|
|
"flex min-h-[var(--header-height)] shrink-0 grow-0 flex-col overflow-hidden px-6 transition-all",
|
|
|
|
menuOpen ? "max-h-none" : "max-h-[var(--header-height)]",
|
|
|
|
)}
|
|
|
|
>
|
|
|
|
<div className="center hidden min-h-[var(--header-height)] lg:flex">
|
2023-10-17 11:37:48 -04:00
|
|
|
<ul className="font-condensed flex w-full max-w-2xl items-center justify-between text-base font-semibold text-zinc-800 hover:text-zinc-600">
|
2023-10-13 19:02:59 -04:00
|
|
|
{navigation.slice(0, 2).map((item) => (
|
2023-10-15 12:11:39 -04:00
|
|
|
<li key={item.name} className="">
|
|
|
|
<Link href={item.href} className="flex p-1">
|
2023-10-13 19:02:59 -04:00
|
|
|
<div className="center w-full ">{item.label}</div>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
<Link href="/">
|
2023-10-14 12:09:44 -04:00
|
|
|
<Logo className="h-8 w-8 text-primary" />
|
2023-10-13 19:02:59 -04:00
|
|
|
</Link>
|
|
|
|
{navigation.slice(2, 4).map((item) => (
|
2023-10-15 12:11:39 -04:00
|
|
|
<li key={item.name} className="">
|
|
|
|
<Link href={item.href} className="flex p-1">
|
2023-10-13 19:02:59 -04:00
|
|
|
<div className="center w-full">{item.label}</div>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div className="flex min-h-[var(--header-height)] flex-1 items-stretch justify-between gap-x-4 lg:hidden">
|
|
|
|
<div className="center justify-between gap-x-3 text-primary">
|
2023-10-14 12:09:44 -04:00
|
|
|
<Logo className="h-7 w-7" />
|
2023-10-13 19:02:59 -04:00
|
|
|
</div>
|
|
|
|
<div className="flex grow items-center justify-end">
|
|
|
|
<button
|
|
|
|
onClick={() => setMenuOpen((prev) => !prev)}
|
|
|
|
className="center text-foregroun hover:text-muted-foreground"
|
|
|
|
>
|
|
|
|
{menuOpen ? (
|
|
|
|
<RiCloseFill className="h-6 w-6" />
|
|
|
|
) : (
|
|
|
|
<RiMenu3Line className="h-6 w-6" />
|
|
|
|
)}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<nav className="lg:hidden">
|
|
|
|
<ul className="mb-5 flex w-full flex-col items-stretch border-t">
|
|
|
|
{navigation.map((item) => (
|
2023-10-15 12:11:39 -04:00
|
|
|
<li key={item.name} className="">
|
|
|
|
<Link href={item.href} className="flex p-1">
|
2023-10-13 19:02:59 -04:00
|
|
|
<div className="center w-full rounded-sm bg-zinc-50 py-3 hover:bg-zinc-100">
|
|
|
|
{item.label}
|
|
|
|
</div>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|