"use client"; import { useId, useState, type MouseEvent, type ReactNode } from "react"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; export type ExpandNavItem = { label: string; href: string; /** Icon (an svg works best). */ icon: ReactNode; /** Tint of this tab when it is open. */ color?: string; }; type ExpandNavProps = { items: ExpandNavItem[]; /** href of the active link at start. Defaults to the first item. */ active?: string; /** Called on click. Call e.preventDefault() to stop the browser following the link. */ onSelect?: (item: ExpandNavItem, e: MouseEvent) => void; /** Name read out by screen readers. */ label?: string; /** Bar look. */ className?: string; }; /* ExpandNav: icon tabs. The picked one opens up to show its name in its own colour, and the others make room. */ export function ExpandNav({ items, active, onSelect, label = "Main", className = "rounded-full border border-white/10 bg-[#141026] p-1.5 text-sm text-white/60", }: ExpandNavProps) { const reduce = useReducedMotion(); const uid = useId(); const [current, setCurrent] = useState(active ?? items[0]?.href); const spring = reduce ? { duration: 0 } : { type: "spring" as const, stiffness: 420, damping: 34 }; return ( ); }