"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { m } from "motion/react"; import { ThemeToggle } from "@/components/ui/ThemeToggle"; const navLinks = [ { label: "Home", href: "/" }, { label: "Posts", href: "/posts/" }, ]; export function Header() { const pathname = usePathname(); return (
Krishna
{navLinks.map((link) => { const isActive = link.href === "/" ? pathname === "/" : pathname === link.href.slice(0, -1) || pathname.startsWith(link.href); return ( {link.label} ); })}
); }