Fix icon overlay for person badges (#10201)

This commit is contained in:
Joakim Sørensen 2021-10-09 12:30:51 +02:00 committed by Bram Kragten
parent 5be475ea17
commit 0056d75127
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B

View File

@ -73,6 +73,12 @@ export class HaStateLabelBadge extends LitElement {
const value = this._computeValue(domain, entityState); const value = this._computeValue(domain, entityState);
const icon = this.icon ? this.icon : this._computeIcon(domain, entityState); const icon = this.icon ? this.icon : this._computeIcon(domain, entityState);
const image = this.icon
? ""
: this.image
? this.image
: entityState.attributes.entity_picture_local ||
entityState.attributes.entity_picture;
return html` return html`
<ha-label-badge <ha-label-badge
@ -81,12 +87,7 @@ export class HaStateLabelBadge extends LitElement {
"has-unit_of_measurement": "has-unit_of_measurement":
"unit_of_measurement" in entityState.attributes, "unit_of_measurement" in entityState.attributes,
})} })}
.image=${this.icon .image=${image}
? ""
: this.image
? this.image
: entityState.attributes.entity_picture_local ||
entityState.attributes.entity_picture}
.label=${this._computeLabel( .label=${this._computeLabel(
domain, domain,
entityState, entityState,
@ -94,7 +95,7 @@ export class HaStateLabelBadge extends LitElement {
)} )}
.description=${this.name ?? computeStateName(entityState)} .description=${this.name ?? computeStateName(entityState)}
> >
${icon ? html`<ha-icon .icon=${icon}></ha-icon>` : ""} ${!image && icon ? html`<ha-icon .icon=${icon}></ha-icon>` : ""}
${value && (this.icon || !this.image) ${value && (this.icon || !this.image)
? html`<span class=${value && value.length > 4 ? "big" : ""} ? html`<span class=${value && value.length > 4 ? "big" : ""}
>${value}</span >${value}</span