Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Commit

Permalink
fix editor text
Browse files Browse the repository at this point in the history
  • Loading branch information
maykar committed Jun 24, 2020
1 parent 961e601 commit 38fb395
Showing 1 changed file with 39 additions and 13 deletions.
52 changes: 39 additions & 13 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,19 +256,41 @@ class ChConfigEditor extends LitElement {
const editorWarning = html`
<ha-icon icon="mdi:alert-box-outline" class="alert" title="${localize('editor.removes_edit_ui')}"></ha-icon>
`;
return html`
<ha-switch
class="${this.exception && this.config[option] === undefined ? 'inherited slotted' : 'slotted'}"
?checked="${this.getConfig(option) !== false && !this.templateExists(this.getConfig(option))}"
.configValue="${option}"
@change="${this._valueChanged}"
title=${title}
?disabled=${this.templateExists(this.getConfig(option))}
>
${text} ${this.templateExists(this.getConfig(option)) && templateWarn ? templateIcon : ''}
${editorWarn ? editorWarning : ''}
</ha-switch>
`;
if (ha_elements().hass.config.version > '0.112.0') {
return html`
<div>
<ha-switch
class="${this.exception && this.config[option] === undefined ? 'inherited slotted' : 'slotted'}"
?checked="${this.getConfig(option) !== false && !this.templateExists(this.getConfig(option))}"
.configValue="${option}"
@change="${this._valueChanged}"
title=${title}
?disabled=${this.templateExists(this.getConfig(option))}
>
</ha-switch>
<switch-text>
<sw-text title=${title}
>${text} ${this.templateExists(this.getConfig(option)) && templateWarn ? templateIcon : ''}</sw-text
>
${editorWarn ? editorWarning : ''}
</switch-text>
</div>
`;
} else {
return html`
<ha-switch
class="${this.exception && this.config[option] === undefined ? 'inherited slotted' : 'slotted'}"
?checked="${this.getConfig(option) !== false && !this.templateExists(this.getConfig(option))}"
.configValue="${option}"
@change="${this._valueChanged}"
title=${title}
?disabled=${this.templateExists(this.getConfig(option))}
>
${text} ${this.templateExists(this.getConfig(option)) && templateWarn ? templateIcon : ''}
${editorWarn ? editorWarning : ''}
</ha-switch>
`;
}
}

render() {
Expand Down Expand Up @@ -619,6 +641,10 @@ class ChConfigEditor extends LitElement {
margin-bottom: 5px;
width: 100%;
}
switch-text {
padding-left: 10px;
vertical-align: bottom;
}
ha-switch {
padding-top: 16px;
}
Expand Down

0 comments on commit 38fb395

Please sign in to comment.