mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-15 22:10:20 +00:00
Cache brand images (#17840)
This commit is contained in:
@@ -112,9 +112,7 @@ export class StateBadge extends LitElement {
|
||||
const stateObj = this.stateObj;
|
||||
|
||||
const iconStyle: { [name: string]: string } = {};
|
||||
const hostStyle: Partial<CSSStyleDeclaration> = {
|
||||
backgroundImage: "",
|
||||
};
|
||||
let backgroundImage = "";
|
||||
|
||||
this._showIcon = true;
|
||||
|
||||
@@ -135,13 +133,12 @@ export class StateBadge extends LitElement {
|
||||
if (domain === "camera") {
|
||||
imageUrl = cameraUrlWithWidthHeight(imageUrl, 80, 80);
|
||||
}
|
||||
hostStyle.backgroundImage = `url(${imageUrl})`;
|
||||
backgroundImage = `url(${imageUrl})`;
|
||||
this._showIcon = false;
|
||||
if (domain === "update") {
|
||||
hostStyle.borderRadius = "0";
|
||||
}
|
||||
if (domain === "media_player") {
|
||||
hostStyle.borderRadius = "8%";
|
||||
this.style.borderRadius = "0";
|
||||
} else if (domain === "media_player") {
|
||||
this.style.borderRadius = "8%";
|
||||
}
|
||||
} else if (this.color) {
|
||||
// Externally provided overriding color wins over state color
|
||||
@@ -182,12 +179,12 @@ export class StateBadge extends LitElement {
|
||||
if (this.hass) {
|
||||
imageUrl = this.hass.hassUrl(imageUrl);
|
||||
}
|
||||
hostStyle.backgroundImage = `url(${imageUrl})`;
|
||||
backgroundImage = `url(${imageUrl})`;
|
||||
this._showIcon = false;
|
||||
}
|
||||
|
||||
this._iconStyle = iconStyle;
|
||||
Object.assign(this.style, hostStyle);
|
||||
this.style.backgroundImage = backgroundImage;
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
||||
Reference in New Issue
Block a user