"use client";
import Link from "next/link";
import { AppContainer } from "./AppContainer";
import { Icons } from "./Icons";
import { LINKS, 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("text-lg font-semibold hover:text-gold duration-300", {
variants: {
active: {
false: "text-primary",
true: "text-gold",
},
},
});
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="py-3 capitalize text-primary text-lg dark:text-white duration-200 font-semibold hover:text-gray-900"
>
{item.label}
);
})}
{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}
);
})}
{SOCIALS_HEADER.map(({ href, external, icon }, index) => {
return (
{icon}
);
})}
);
};
export const AppHeader = () => {
return (
);
};