43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import Link from "next/link"
|
|
import { usePathname } from "next/navigation"
|
|
import { cn } from "@/lib/utils"
|
|
|
|
const navItems = [
|
|
{ href: "/", label: "Sport Home" },
|
|
{ href: "/live", label: "Live" },
|
|
]
|
|
|
|
export function SiteHeader() {
|
|
const pathname = usePathname()
|
|
|
|
return (
|
|
<header className="border-b bg-card">
|
|
<div className="mx-auto flex max-w-6xl items-center justify-between px-4 py-3">
|
|
<div className="text-lg font-semibold tracking-tight">Harifsport</div>
|
|
<nav className="flex gap-2 text-sm">
|
|
{navItems.map((item) => {
|
|
const isActive =
|
|
item.href === "/"
|
|
? pathname === "/"
|
|
: pathname?.startsWith(item.href)
|
|
return (
|
|
<Link
|
|
key={item.href}
|
|
href={item.href}
|
|
className={cn(
|
|
"rounded-full px-4 py-1.5 transition-colors",
|
|
"text-muted-foreground hover:text-foreground hover:bg-muted",
|
|
isActive && "bg-primary text-primary-foreground"
|
|
)}
|
|
>
|
|
{item.label}
|
|
</Link>
|
|
);
|
|
})}
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
)
|
|
}
|
|
|