ref: remove classname from navbar link

This commit is contained in:
Nicholas Tindle
2025-01-28 16:23:14 +00:00
parent c873ba04b8
commit b317adb9cf
2 changed files with 10 additions and 14 deletions

View File

@@ -67,7 +67,6 @@ export const Navbar = async ({ links, menuItemGroups }: NavbarProps) => {
key={link.name}
name={link.name}
href={link.href}
className="font-poppins text-[20px] leading-[28px]"
/>
))}
</div>

View File

@@ -12,22 +12,20 @@ import { usePathname } from "next/navigation";
interface NavbarLinkProps {
name: string;
href: string;
className?: string;
}
export const NavbarLink = ({ name, href, className }: NavbarLinkProps) => {
export const NavbarLink = ({ name, href }: NavbarLinkProps) => {
const pathname = usePathname();
const parts = pathname.split("/");
const activeLink = "/" + (parts.length > 2 ? parts[2] : parts[1]);
return (
<Link href={href} data-testid={`navbar-link-${name.toLowerCase()}`}>
<Link href={href} data-testid={`navbar-link-${name.toLowerCase()}`} className="font-poppins text-[20px] leading-[28px]">
<div
className={`h-[48px] px-5 py-4 ${className} ${
activeLink === href
? "rounded-2xl bg-neutral-800 dark:bg-neutral-200"
: ""
} flex items-center justify-start gap-3`}
className={`h-[48px] px-5 py-4 ${activeLink === href
? "rounded-2xl bg-neutral-800 dark:bg-neutral-200"
: ""
} flex items-center justify-start gap-3`}
>
{href === "/marketplace" && (
<IconShoppingCart
@@ -50,11 +48,10 @@ export const NavbarLink = ({ name, href, className }: NavbarLinkProps) => {
/>
)}
<div
className={`font-poppins text-[20px] font-medium leading-[28px] ${
activeLink === href
? "text-neutral-50 dark:text-neutral-900"
: "text-neutral-900 dark:text-neutral-50"
}`}
className={`font-poppins text-[20px] font-medium leading-[28px] ${activeLink === href
? "text-neutral-50 dark:text-neutral-900"
: "text-neutral-900 dark:text-neutral-50"
}`}
>
{name}
</div>