Files

19 lines
598 B
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { ReactNode } from "react";
export default function NavItem({ path, children }: { path: string; children: ReactNode }) {
const pathname = usePathname();
const isActive = pathname === path;
return (
<Link
href={path}
className={`px-3 py-1 rounded-full border border-transparent hover:border-current transition-all ${
isActive ? "bg-black text-white dark:bg-white dark:text-black" : ""
}`}
>{children}</Link>
);
}