Skip to content

Commit

Permalink
Display fixes plus add to card picker
Browse files Browse the repository at this point in the history
  • Loading branch information
gadgetchnnel committed Jul 13, 2020
1 parent ec734ff commit ab31085
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 7 deletions.
10 changes: 5 additions & 5 deletions lovelace-home-feed-card.js

Large diffs are not rendered by default.

28 changes: 26 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,13 @@ class HomeFeedCard extends LitElement {
else{
if(this.feedContent != null){
if(this.feedContent.length === 0 && this._config.show_empty === false){
this.style.display = "none";

return html``;
}
else{
this.style.display = "block";

return html`
${HomeFeedCard.stylesheet}
<ha-card id="card">
Expand All @@ -213,6 +217,8 @@ class HomeFeedCard extends LitElement {
}
}
else{
this.style.display = "none";

return html``;
}
}
Expand Down Expand Up @@ -1089,9 +1095,27 @@ class HomeFeedCard extends LitElement {
}

getCardSize() {
return 2;
if (!this._config || !this.feedContent) {
return 0;
}
// +1 for the header
let size = (this._config.title ? 1 : 0) + (this.feedContent.length || 1);

if(this._config.header) size += 1;

if(this._config.footer) size += 1;

return size;
}
}

customElements.define("home-feed-card", HomeFeedCard);
customElements.define("home-feed-notification-popup", HomeFeedNotificationPopup);
customElements.define("home-feed-notification-popup", HomeFeedNotificationPopup);

window.customCards = window.customCards || [];
window.customCards.push({
type: "home-feed-card",
name: "Home Feed Card",
preview: false,
description: "Display persistent notifications, calendar events, and entities as a feed." // Optional
});

0 comments on commit ab31085

Please sign in to comment.