'use client';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { ReactNode } from 'react';
interface NavLinkProps {
href: string;
icon: ReactNode;
label: string;
onClick?: () => void;
className?: string;
}
export function NavLink({ href, icon, label, onClick, className }: NavLinkProps) {
const pathname = usePathname();
// Check if path matches (accounting for locale prefix)
const pathWithoutLocale = pathname.replace(/^\/(de|en|sr)/, '');
const hrefWithoutLocale = href.replace(/^\/(de|en|sr)/, '');
const isActive = pathWithoutLocale === hrefWithoutLocale ||
(hrefWithoutLocale === '' && pathWithoutLocale === '');
return (
{icon}
{label}
);
}