import Link from "next/link";
import { portfolioPdf } from "@/content/site";
import type { NavKey } from "@/lib/routes";
import { DownloadIcon } from "@/components/icons";
import type { NavItem } from "./nav-item";

const itemClass =
  "flex items-center gap-0.5 p-2 text-sm leading-6 tracking-[0.17px] text-soft transition hover:text-white aria-[current=page]:font-bold aria-[current=page]:text-white";

type DesktopNavProps = { links: NavItem[]; activeKey?: NavKey; label: string; portfolioLabel: string; className?: string };

export function DesktopNav({ links, activeKey, label, portfolioLabel, className }: DesktopNavProps) {
  return (
    <nav aria-label={label} className={className}>
      <ul className="flex items-center gap-2">
        {links.map(({ key, href, label }) => (
          <li key={key}>
            <Link href={href} aria-current={key === activeKey ? "page" : undefined} className={itemClass}>
              {label}
            </Link>
          </li>
        ))}
        <li>
          <a href={portfolioPdf} download className={itemClass}>
            {portfolioLabel}
            <DownloadIcon className="size-[18px]" />
          </a>
        </li>
      </ul>
    </nav>
  );
}
