"use client"; import type { ReactNode } from "react"; export type AdminSegmentOption = { key: T; label: string; icon?: ReactNode; count?: number | string; disabled?: boolean; }; /** 分段筛选:可带 count / icon;选中态走 --nav-active-* */ export default function AdminSegmented({ options, value, onChange, ariaLabel, size = "md", role = "tablist", }: { options: AdminSegmentOption[]; value: T; onChange: (key: T) => void; ariaLabel: string; size?: "md" | "sm"; role?: "tablist" | "group"; }) { const useTabs = role === "tablist"; return (
{options.map((opt) => { const active = value === opt.key; return ( ); })}
); }