"use client"; import Link from "next/link"; import type { LucideIcon } from "lucide-react"; import { cn } from "@/lib/utils"; export interface PageTabItem { id: string; label: string; description?: string; count?: number; href?: string; icon?: LucideIcon; } interface PageTabsProps { items: PageTabItem[]; activeId: string; onSelect?: (id: string) => void; className?: string; } export function PageTabs({ items, activeId, onSelect, className, }: PageTabsProps) { return (
{items.map((item) => { const active = item.id === activeId; const Icon = item.icon; const content = ( <> {Icon && ( )} {item.label} {item.count !== undefined && ( {item.count} )} {item.description && ( {item.description} )} ); const className = cn( "relative rounded-lg border px-4 py-3 text-left transition-colors", "hover:border-primary/35 hover:bg-accent/45 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50", active ? "border-primary/35 bg-card text-foreground shadow-sm before:absolute before:inset-x-4 before:top-0 before:h-0.5 before:rounded-full before:bg-primary" : "border-border bg-background/70 text-muted-foreground", ); if (item.href) { return ( {content} ); } return ( ); })}
); }