Skip to content

Commit

Permalink
- reformating of light detail templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Gh61 committed Jun 13, 2023
1 parent ec04fbc commit 67c7c42
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/controls/light-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ export class HueLightDetail extends IdLitElement {
return html`
<div>
<ha-icon-button-prev class='back-button' @click=${() => this.hide()}></ha-icon-button-prev>
${cache(
onlySwitch
? this.createSwitchDetail()
: this.createFullDetail()
)}
${cache(onlySwitch ? this.createSwitchDetail() : this.createFullDetail())}
</div>`;
}

Expand All @@ -257,8 +253,10 @@ export class HueLightDetail extends IdLitElement {

private createSwitchDetail() {
const light = this._lastRenderedContainer!;
const offColor = Consts.OffColor;
const onColor = Consts.WarmColor;
const colors = {
'--control-switch-on-color': Consts.WarmColor,
'--control-switch-off-color': Consts.OffColor
};

return html`
<${unsafeStatic(HueBigSwitch.ElementName)} class='light-switch'
Expand All @@ -267,10 +265,7 @@ export class HueLightDetail extends IdLitElement {
.checked=${light.isOn()}
.showHandle=${!light.isUnavailable()}
@change=${(ev: Event) => this.onSwitch(light, ev)}
style=${styleMap({
'--control-switch-on-color': onColor,
'--control-switch-off-color': offColor
})}
style=${styleMap(colors)}
.disabled=${light.isUnavailable()}
>
<ha-icon icon="mdi:power-on" slot="icon-on"></ha-icon>
Expand Down

0 comments on commit 67c7c42

Please sign in to comment.