mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-18 18:40:47 -04:00
slorp
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
|
||||
export default function ToggleControl({ entity, disabled, onChange }) {
|
||||
const on = entity.state === 'on';
|
||||
const on = entity.state === true || 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 ? 'off' : 'on')}
|
||||
disabled={disabled} onClick={() => onChange(!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>
|
||||
|
||||
Reference in New Issue
Block a user