import { LINKS } from "@/shared/variables/links";
import "./NavMenu.scss";
import Link from "next/link";
import { usePathname } from "next/navigation";
import NavAuth from "../NavAuth/NavAuth";

interface INavMenuProps {
  setOpenMenu: (boolean: boolean) => void;
}

const NavMenu: React.FC<INavMenuProps> = ({
  setOpenMenu,
}: INavMenuProps) => {
  const pathname = usePathname();
  return (
    <nav className="nav-menu">
      {LINKS.map((link) => (
        <Link
          onClick={() => setOpenMenu(false)}
          className={`nav-menu__link${
            pathname === link.pathname ? "_active" : ""
          }`}
          href={link.pathname}
          key={link.id}
        >
          {link.pagename}
        </Link>
      ))}

      <NavAuth setOpenMenu={setOpenMenu} responsible />
    </nav>
  );
};

export default NavMenu;
