add icon option to entities card name (#4024)

* add icon option to entities card name

* account for only icon

* address comments
This commit is contained in:
Ian Richardson 2019-10-19 07:25:14 -05:00 committed by Bram Kragten
parent 0a77728652
commit fbee4937a0
2 changed files with 20 additions and 4 deletions

View File

@ -82,16 +82,27 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
if (!this._config || !this._hass) {
return html``;
}
const { show_header_toggle, title } = this._config;
return html`
<ha-card>
${!title && !show_header_toggle
${!this._config.title &&
!this._config.show_header_toggle &&
!this._config.icon
? html``
: html`
<div class="card-header">
<div class="name">${title}</div>
${show_header_toggle === false
<div class="name">
${this._config.icon
? html`
<ha-icon
class="icon"
.icon="${this._config.icon}"
></ha-icon>
`
: ""}
${this._config.title}
</div>
${this._config.show_header_toggle === false
? html``
: html`
<hui-entities-toggle
@ -140,6 +151,10 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard {
.state-card-dialog {
cursor: pointer;
}
.icon {
padding: 0px 18px 0px 8px;
}
`;
}

View File

@ -35,6 +35,7 @@ export interface EntitiesCardConfig extends LovelaceCardConfig {
title?: string;
entities: EntitiesCardEntityConfig[];
theme?: string;
icon?: string;
}
export interface EntityButtonCardConfig extends LovelaceCardConfig {