import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "@/components/ui/tooltip"; import { cn } from "@/util/utils"; type Option = { label: string; value: string; helpText?: string; }; type Props = { className?: string; highlight?: boolean; options: Option[]; value: string; onChange: (value: string) => void; }; function SwitchBar({ className, highlight, options, value, onChange }: Props) { return (
{options.map((option) => { const selected = option.value === value; const optionElement = (
{ if (!selected) { onChange(option.value); } }} > {option.label}
); if (option.helpText) { return ( {optionElement} {option.helpText} ); } return optionElement; })}
); } export { SwitchBar };