Media Card: Fix Style Maps (#5120)

* Fix style map

* Comments
This commit is contained in:
Zack Arnett 2020-03-11 03:42:34 -04:00 committed by GitHub
parent ff4d5265c5
commit e062940639
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,7 +164,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
const imageStyle = { const imageStyle = {
"background-image": `url(${this.hass.hassUrl(this._image)})`, "background-image": `url(${this.hass.hassUrl(this._image)})`,
width: `${this._cardHeight}px`, width: `${this._cardHeight}px`,
"background-color": `${this._backgroundColor}`, "background-color": this._backgroundColor || "",
}; };
const gradientStyle = { const gradientStyle = {
@ -190,11 +190,15 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
> >
<div <div
class="color-block" class="color-block"
style=${styleMap({ "background-color": this._backgroundColor! })} style=${styleMap({
"background-color": this._backgroundColor || "",
})}
></div> ></div>
<div <div
class="no-img" class="no-img"
style=${styleMap({ "background-color": this._backgroundColor! })} style=${styleMap({
"background-color": this._backgroundColor || "",
})}
></div> ></div>
<div class="image" style=${styleMap(imageStyle)}></div> <div class="image" style=${styleMap(imageStyle)}></div>
${hasNoImage ${hasNoImage
@ -213,7 +217,7 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard {
off: isOffState || isUnavailable, off: isOffState || isUnavailable,
"no-progress": !this._showProgressBar && !this._veryNarrow, "no-progress": !this._showProgressBar && !this._veryNarrow,
})}" })}"
style=${styleMap({ color: this._foregroundColor! })} style=${styleMap({ color: this._foregroundColor || "" })}
> >
<div class="top-info"> <div class="top-info">
<div class="icon-name"> <div class="icon-name">