mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Disable counter buttons if entity is unavailable (#8084)
This commit is contained in:
parent
4a61779aba
commit
0208b50ac7
@ -10,6 +10,7 @@ import {
|
||||
TemplateResult,
|
||||
} from "lit-element";
|
||||
import { HomeAssistant } from "../../../types";
|
||||
import { UNAVAILABLE_STATES } from "../../../data/entity";
|
||||
|
||||
@customElement("more-info-counter")
|
||||
class MoreInfoCounter extends LitElement {
|
||||
@ -22,21 +23,29 @@ class MoreInfoCounter extends LitElement {
|
||||
return html``;
|
||||
}
|
||||
|
||||
const disabled = UNAVAILABLE_STATES.includes(this.stateObj!.state);
|
||||
|
||||
return html`
|
||||
<div class="actions">
|
||||
<mwc-button
|
||||
.action="${"increment"}"
|
||||
@click="${this._handleActionClick}"
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
${this.hass!.localize("ui.card.counter.actions.increment")}
|
||||
</mwc-button>
|
||||
<mwc-button
|
||||
.action="${"decrement"}"
|
||||
@click="${this._handleActionClick}"
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
${this.hass!.localize("ui.card.counter.actions.decrement")}
|
||||
</mwc-button>
|
||||
<mwc-button .action="${"reset"}" @click="${this._handleActionClick}">
|
||||
<mwc-button
|
||||
.action="${"reset"}"
|
||||
@click=${this._handleActionClick}
|
||||
.disabled=${disabled}
|
||||
>
|
||||
${this.hass!.localize("ui.card.counter.actions.reset")}
|
||||
</mwc-button>
|
||||
</div>
|
||||
@ -53,8 +62,7 @@ class MoreInfoCounter extends LitElement {
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
.actions {
|
||||
margin: 0;
|
||||
padding-top: 20px;
|
||||
margin: 8px 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
@ -75,7 +75,7 @@ class MoreInfoPerson extends LitElement {
|
||||
justify-content: space-between;
|
||||
}
|
||||
.actions {
|
||||
margin: 36px 0 8px 0;
|
||||
margin: 8px 0;
|
||||
text-align: right;
|
||||
}
|
||||
ha-map {
|
||||
|
@ -76,8 +76,7 @@ class MoreInfoTimer extends LitElement {
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
.actions {
|
||||
margin: 0;
|
||||
padding-top: 20px;
|
||||
margin: 8px 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
Loading…
x
Reference in New Issue
Block a user