({
label,
description,
enabled,
onChange,
warning
}: {
label: string
description: string
enabled: boolean
onChange: (value: boolean) => void
warning?: string
})
| 2417 | } |
| 2418 | |
| 2419 | function ToggleSetting({ |
| 2420 | label, |
| 2421 | description, |
| 2422 | enabled, |
| 2423 | onChange, |
| 2424 | warning |
| 2425 | }: { |
| 2426 | label: string |
| 2427 | description: string |
| 2428 | enabled: boolean |
| 2429 | onChange: (value: boolean) => void |
| 2430 | warning?: string |
| 2431 | }) { |
| 2432 | return ( |
| 2433 | <div className="flex items-start justify-between gap-4 p-4 bg-theme-dim border border-theme-primary rounded-lg"> |
| 2434 | <div className="flex-1"> |
| 2435 | <h4 className="font-semibold">{label}</h4> |
| 2436 | <p className="text-sm theme-secondary">{description}</p> |
| 2437 | {warning && enabled && ( |
| 2438 | <p className="text-xs text-yellow-500 mt-1 flex items-center gap-1"> |
| 2439 | <AlertTriangle className="w-3 h-3" /> |
| 2440 | {warning} |
| 2441 | </p> |
| 2442 | )} |
| 2443 | </div> |
| 2444 | <button |
| 2445 | onClick={() => onChange(!enabled)} |
| 2446 | className={`w-12 h-6 rounded-full transition-colors relative flex-shrink-0 |
| 2447 | ${enabled ? 'bg-green-500' : 'bg-theme-accent'}`} |
| 2448 | > |
| 2449 | <span |
| 2450 | className={`absolute top-1 w-4 h-4 rounded-full bg-white transition-transform |
| 2451 | ${enabled ? 'left-7' : 'left-1'}`} |
| 2452 | /> |
| 2453 | </button> |
| 2454 | </div> |
| 2455 | ) |
| 2456 | } |
nothing calls this directly
no outgoing calls
no test coverage detected