Skip to content

Commit

Permalink
Better handling of extra_styles
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Apr 13, 2020
1 parent a8d1a37 commit 37bbd82
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/button-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,13 @@ class ButtonCard extends LitElement {
);
lockStyle = { ...lockStyle, ...lockStyleFromConfig };

const extraStyles = document.createElement('style');
extraStyles.innerHTML = this._config!.extra_styles
? this._getTemplateOrValue(this._stateObj, this._config!.extra_styles)
: '';
const extraStyles = this._config!.extra_styles
? html`
<style>
${this._getTemplateOrValue(this._stateObj, this._config!.extra_styles)}
</style>
`
: html``;
return html`
${extraStyles}
<div id="aspect-ratio" style=${styleMap(aspectRatio)}>
Expand Down

0 comments on commit 37bbd82

Please sign in to comment.