// Segmented — an iOS-style segmented control with a sliding active pill. Shared // by the debug console's tester / stream panels. Extracted from the original // debug page so multiple panels reuse one implementation. import { useId, type ReactNode } from 'react'; import { motion } from 'motion/react'; import { cn } from '@/lib/utils'; export function Segmented({ value, onChange, options }: { value: T; onChange: (v: T) => void; options: { value: T; label: ReactNode }[]; }) { const id = useId(); return (
{options.map((o) => { const active = o.value === value; return ( ); })}
); }