import React from 'react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; export interface SwitchOption { value: T; label: React.ReactNode; } export interface SwitchButtonGroupProps extends Omit< React.HTMLAttributes, 'onChange' > { value: T; options: SwitchOption[]; onChange: (value: T) => void; size?: 'small' | 'medium' | 'large'; buttonClassName?: string; } const SIZE_CLASSES = { small: 'text-xs h-8 px-2 py-1 rounded-md', medium: 'text-sm h-9 px-3 py-1.5 rounded-md', large: 'text-base h-11 px-4 py-2 rounded-lg', } as const; const SELECTED_CLASSES = 'bg-background text-foreground shadow-sm font-semibold animate-in fade-in-50 zoom-in-95 duration-150'; const UNSELECTED_CLASSES = 'hover:bg-background/50 hover:text-foreground/80'; export default function SwitchButtonGroup({ value, options, onChange, size = 'medium', className, buttonClassName, ...props }: SwitchButtonGroupProps) { return (
{options.map((option) => ( ))}
); }