'use client' type ToggleOption = { value: T label?: string text?: string icon?: React.ReactNode } type ToggleProps = { value: T onChange: (value: T) => void left: ToggleOption right: ToggleOption } export default function Toggle({ value, onChange, left, right, }: ToggleProps) { const active = 'bg-login text-white shadow-sm' const idle = 'text-login-200 hover:text-login-50 hover:bg-login-500/50' const base = 'flex items-center justify-center rounded-md px-3 h-7 transition-all duration-150 gap-1.5 text-sm' function renderContent(opt: ToggleOption) { return ( <> {opt.icon} {opt.text && {opt.text}} ) } const isLeftActive = value === left.value const isRightActive = value === right.value return (
) }