- Add 15 optimized WebP images for portfolio (21-53KB each) - Redesign Hero section with full-width background image - Add SSR support for Hero component - Update About section with new portrait image - Update Contact page with professional headshot - Add images to Services/Leistungen page - Add image optimization script (sharp) - Update translations for gallery section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
'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 (
|
|
<Link
|
|
href={href}
|
|
onClick={onClick}
|
|
className={`
|
|
relative flex items-center gap-2 rounded-full py-2 px-4
|
|
transition-all duration-200 ease-in-out
|
|
${isActive ? 'text-white bg-zinc-700/60' : 'text-zinc-400 hover:text-white hover:bg-zinc-800/30'}
|
|
${className || ''}
|
|
`}
|
|
>
|
|
{icon}
|
|
<span className="text-sm tracking-wide">{label}</span>
|
|
</Link>
|
|
);
|
|
}
|