undo undo

This commit is contained in:
legop3
2026-09-16 13:59:13 -04:00
parent 318cad1846
commit 51b42ea778
23 changed files with 197 additions and 817 deletions
@@ -1,11 +1,11 @@
export default function ToggleControl({ entity, disabled, onChange }) {
const on = entity.state === true || entity.state === 'on';
const on = entity.state === 'on';
// The label reflects reported state, rather than claiming success before HA
// publishes it. The entire compact button remains an accessible click target.
return <>
<button type="button" aria-label={`Toggle ${entity.name}`} aria-pressed={on}
disabled={disabled} onClick={() => onChange(!on)}
disabled={disabled} onClick={() => onChange(on ? 'off' : 'on')}
className={`w-full rounded border px-1 py-0.5 text-xs font-semibold disabled:opacity-50 ${on ? 'border-emerald-700/70 bg-emerald-900 text-white' : 'border-neutral-700 bg-neutral-950 text-slate-300'}`}>
{on ? 'On' : 'Off'}
</button>