header.tsx46 lines, 1.4 KB
| 1 | "use client"; |
| 2 | |
| 3 | import { cn } from "@/lib/utils"; |
| 4 | import Link from "next/link"; |
| 5 | import { usePathname } from "next/navigation"; |
| 6 | import { Button } from "./ui/button"; |
| 7 | import { UserButton } from "./shared/user-button"; |
| 8 | |
| 9 | const navItems: { name: string; href: string }[] = [ |
| 10 | { name: "Dashboard", href: "/dashboard" }, |
| 11 | { name: "Pricing", href: "/pricing" }, |
| 12 | { name: "Privacy Policy", href: "/privacy" }, |
| 13 | ]; |
| 14 | |
| 15 | export function Header() { |
| 16 | const pathname = usePathname(); |
| 17 | |
| 18 | return ( |
| 19 | <header className="sticky px-4 top-0 z-50 w-full border-b bg-background/95 backdrop-blur"> |
| 20 | <div className="container flex h-16 items-center"> |
| 21 | <div className="mr-4 hidden md:flex"> |
| 22 | <Link href={"/"} className="mr-6 flex items-center space-x-2"> |
| 23 | LOGO |
| 24 | </Link> |
| 25 | <nav className="flex items-center space-x-7 text-sm font-medium"> |
| 26 | {navItems.map((item) => ( |
| 27 | <Link |
| 28 | key={item.name} |
| 29 | href={item.href} |
| 30 | className={cn( |
| 31 | "transition-colors hover:text-foreground/80", |
| 32 | pathname === item.href |
| 33 | ? "text-foreground" |
| 34 | : "text-foreground/60" |
| 35 | )} |
| 36 | > |
| 37 | {item.name} |
| 38 | </Link> |
| 39 | ))} |
| 40 | </nav> |
| 41 | </div> |
| 42 | <UserButton /> |
| 43 | </div> |
| 44 | </header> |
| 45 | ); |
| 46 | } |