infoalloggi-monorepo/apps/infoalloggi/src/components/navbar/main-nav.tsx

41 lines
1,010 B
TypeScript
Raw Normal View History

2025-08-04 17:45:44 +02:00
import Link from "next/link";
import { LogoSvg } from "~/components/svgs";
2025-08-28 18:27:07 +02:00
import { cn } from "~/lib/utils";
2025-08-04 17:45:44 +02:00
import { useTranslation } from "~/providers/I18nProvider";
2025-08-28 18:27:07 +02:00
2025-08-04 17:45:44 +02:00
type MainNavProps = {
2025-08-28 18:27:07 +02:00
pathname: string;
2025-08-04 17:45:44 +02:00
};
export function MainNav({ pathname }: MainNavProps) {
2025-08-28 18:27:07 +02:00
const { t } = useTranslation();
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
return (
<div className="mr-2 hidden gap-6 md:flex">
<Link
aria-label="mainNavLink"
className="flex shrink-0 items-center font-medium md:mb-0"
2025-08-29 16:18:32 +02:00
href="/"
2025-08-28 18:27:07 +02:00
>
2025-10-10 16:18:43 +02:00
<LogoSvg className="h-8 w-auto [&>g]:fill-red-500 [&>text]:fill-primary [&>text]:stroke-primary" />
2025-08-28 18:27:07 +02:00
</Link>
2025-08-04 17:45:44 +02:00
2025-08-28 18:27:07 +02:00
<nav className="flex items-center gap-4 text-lg tracking-wide lg:gap-6">
{t.nav.mainNav.map((item) => (
<Link
aria-label={item.title}
className={cn(
2025-10-10 16:18:43 +02:00
"transition-colors hover:text-primary/80",
2025-08-28 18:27:07 +02:00
pathname === item.href ? "text-primary" : "text-primary/70",
)}
2025-08-29 16:18:32 +02:00
href={item.href}
key={item.href}
2025-08-28 18:27:07 +02:00
>
{item.title}
</Link>
))}
</nav>
</div>
);
2025-08-04 17:45:44 +02:00
}