"use client";
import Link from "next/link";
import { AppContainer } from "./AppContainer";
import { Icons } from "./Icons";
import { NAVIGATION, SOCIALS_HEADER } from "../app/settings";
import { classed } from "@tw-classed/react";
import { usePathname } from "next/navigation";
import { useState } from "react";
import { cn } from "../shared/utils";
import { LABELS } from "../content";
const NavLabel = classed.span(
"relative overflow-hidden text-base md:text-lg text-primary font-semibold group-hover:text-brown-50 hover:text-gold duration-300 after:content-[''] after:h-1 after:w-full after:bottom-0 after:left-0 after:absolute p-2 duration-200",
{
variants: {
active: {
false: "after:bg-transparent",
true: "after:bg-brown-50",
},
},
}
);
const AppMobileNav = () => {
const [isOpen, setIsOpen] = useState(false);
return (
setIsOpen(true)}>
{isOpen && (
setIsOpen(false)}
>
)}
setIsOpen(false)} aria-label="toggle menu">
{NAVIGATION.map((item, index) => {
return (
setIsOpen(false)}
className="flex items-center py-3 gap-3"
>
{item.label}
{item.external && }
);
})}
{SOCIALS_HEADER.map(({ href, external, icon }, index) => {
return (
{icon}
);
})}
{LABELS.COMMON.FOOTER.TITLE}
);
};
const AppDesktopNav = () => {
const pathname = usePathname();
return (
{NAVIGATION.map(({ label, href, external }, index) => {
const pathParts = href.split("/").filter(Boolean);
const isHome = pathname === "/" && href === "/";
// is home or the first part of the path matches the first part of the href
const isActive = isHome || (pathname !== null && pathParts[0] === pathname.split("/")[1]);
return (
{label}
{external && }
);
})}
{SOCIALS_HEADER.map(({ href, external, icon }, index) => {
return (
{icon}
);
})}
);
};
export const AppHeader = () => {
return (
);
};