Skip to content

Commit

Permalink
Replaced current hide options with a single hide option
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkih committed Dec 22, 2018
1 parent f2d53d7 commit 52d9532
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mini-graph-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MiniGraphCard extends LitElement {
height: 100,
hours_to_show: 24,
icon: false,
hide_icon: false,
hide: [],
labels: false,
line_color: 'var(--accent-color)',
line_width: 5,
Expand Down Expand Up @@ -107,37 +107,38 @@ class MiniGraphCard extends LitElement {
}

renderHeader() {
return (!this.config.hide_icon || !this.config.hide_name) ? html`
const items = ['icon', 'name'];
return !(items.every(el => this.config.hide.includes(el))) ? html`
<div class='header flex'>
${this.renderIcon()}
${this.renderName()}
</div>` : '';
}

renderIcon() {
return !this.config.hide_icon ? html`
return !(this.config.hide.includes('icon')) ? html`
<div class='icon'>
<ha-icon .icon=${this.computeIcon()}></ha-icon>
</div>` : '';
}

renderName() {
return !this.config.hide_name ? html`
return !(this.config.hide.includes('name')) ? html`
<div class='name flex'>
<span class='ellipsis'>${this.computeName()}</span>
</div>` : '';
}

renderState() {
return !this.config.hide_state ? html`
return !(this.config.hide.includes('state')) ? html`
<div class='info flex'>
<span class='state ellipsis'>${this.computeState()}</span>
<span class='uom ellipsis'>${this.computeUom()}</span>
</div> `: '';
}

renderGraph() {
return !this.config.hide_graph ? html`
return !(this.config.hide.includes('graph')) ? html`
<div class='graph'>
${this.config.labels ? this.renderLabels() : ''}
<div class='line'>
Expand Down

0 comments on commit 52d9532

Please sign in to comment.