Skip to content

Commit

Permalink
Prevent invisible cards from taking up space. Ref #41
Browse files Browse the repository at this point in the history
  • Loading branch information
Savjee committed Nov 27, 2022
1 parent dde2fc0 commit f99929e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/button-text-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,13 @@ export class BoilerplateCard extends LitElement {
// Render JS templates
this.evaluateJsTemplates();

if (!this._inEditMode() && this._renderedConfig.hide_condition === true) {

// When card should not be visible, explicitly hide the card by setting
// the display type to none. This avoids padding issues with cards below it.
const invisible = !this._inEditMode() && this._renderedConfig.hide_condition === true;
this.style.setProperty("display", invisible ? "none" : "");

if (invisible) {
return html``;
}

Expand Down

0 comments on commit f99929e

Please sign in to comment.