Files
mybabyguess/apps/web/src/features/predictions/components/main-tab-bar.tsx
T
2026-05-03 21:58:59 +02:00

33 lines
941 B
TypeScript

"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import styles from "../styles/predictions.module.css";
const MAIN_TABS = [
{ href: "/predictions", label: "Pronostics", exact: true },
{ href: "/predictions/recap", label: "Récap", exact: false },
{ href: "/predictions/indices", label: "Indices", exact: false },
];
export function MainTabBar() {
const pathname = usePathname();
return (
<div className={styles.contentTabBar}>
{MAIN_TABS.map(({ href, label, exact }) => {
const isActive = exact ? pathname === href : pathname.startsWith(href);
return (
<Link
key={href}
href={href}
className={`${styles.contentTabItem} ${isActive ? styles.contentTabItemActive : ""}`}
aria-current={isActive ? "page" : undefined}
>
{label}
</Link>
);
})}
</div>
);
}