Consolidate all icon button logic into <ha-icon-button> + ensure tooltip (#9230)

This commit is contained in:
Philip Allgaier
2021-10-14 15:44:20 +02:00
committed by GitHub
parent bddb505b7f
commit 0c940be5fb
152 changed files with 1222 additions and 1120 deletions

View File

@@ -1,3 +1,4 @@
import { mdiFlash, mdiFlashOff } from "@mdi/js";
import { HassEntity } from "home-assistant-js-websocket";
import {
css,
@@ -41,15 +42,15 @@ export class HaEntityToggle extends LitElement {
if (this.stateObj.attributes.assumed_state) {
return html`
<ha-icon-button
aria-label=${`Turn ${computeStateName(this.stateObj)} off`}
icon="hass:flash-off"
.label=${`Turn ${computeStateName(this.stateObj)} off`}
.path=${mdiFlashOff}
.disabled=${this.stateObj.state === UNAVAILABLE}
@click=${this._turnOff}
?state-active=${!this._isOn}
></ha-icon-button>
<ha-icon-button
aria-label=${`Turn ${computeStateName(this.stateObj)} on`}
icon="hass:flash"
.label=${`Turn ${computeStateName(this.stateObj)} on`}
.path=${mdiFlash}
.disabled=${this.stateObj.state === UNAVAILABLE}
@click=${this._turnOn}
?state-active=${this._isOn}