Updating from reviews

This commit is contained in:
Zack Arnett 2018-10-18 09:28:49 -04:00
parent 4c3db2119b
commit 33578a6289

View File

@ -49,8 +49,8 @@ export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
}; };
} }
public getCardSize() { public getCardSize() {
return 3; return (this.config!.title ? 1 : 0) + Math.ceil(this.configEntities!.length / 5);
} }
public setConfig(config: Config) { public setConfig(config: Config) {
@ -89,11 +89,7 @@ export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
${this.renderStyle()} ${this.renderStyle()}
<ha-card .header="${title}"> <ha-card .header="${title}">
<div class="entities ${classMap({ "no-header": !title })}"> <div class="entities ${classMap({ "no-header": !title })}">
${repeat<EntityConfig>( ${this.configEntities!.map(entityConf => this.renderEntity(entityConf))}
this.configEntities!,
(entityConf) => entityConf.entity,
(entityConf) => this.renderEntity(entityConf)
)}
</div> </div>
</ha-card> </ha-card>
`; `;
@ -145,9 +141,9 @@ export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
const stateObj = this.hass!.states[entityConf.entity]; const stateObj = this.hass!.states[entityConf.entity];
if (!stateObj) { if (!stateObj) {
return html`<div class="entity not-found">Entity Not Available: ${ return html`<div class="entity not-found"><div class="name">${
entityConf.entity entityConf.entity
}</div>`; }</div>Entity Not Available</div>`;
} }
return html` return html`