Skip to content

Commit

Permalink
add custom button text
Browse files Browse the repository at this point in the history
  • Loading branch information
finity69x2 authored Jun 7, 2020
1 parent ce4bb7c commit 9eef4e0
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions dist/light-brightness-preset-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ class CustomLightBrightnessRow extends Polymer.Element {
style='[[_lowOnColor]]'
toggles name="low"
on-click='setBrightness'
disabled='[[_isOnLow]]'>LOW</button>
disabled='[[_isOnLow]]'>[[_lowText]]</button>
<button
class='brightness'
style='[[_medOnColor]]'
toggles name="medium"
on-click='setBrightness'
disabled='[[_isOnMed]]'>MED</button>
disabled='[[_isOnMed]]'>[[_medText]]</button>
<button
class='brightness'
style='[[_highOnColor]]'
toggles name="high"
on-click='setBrightness'
disabled='[[_isOnHigh]]'>HIGH</button>
disabled='[[_isOnHigh]]'>[[_hiText]]</button>
<button
class='brightness'
style='[[_offColor]]'
toggles name="off"
on-click='setBrightness'
disabled='[[_isOffState]]'>OFF</button>
disabled='[[_isOffState]]'>[[_offText]]</button>
</div>
</hui-generic-entity-row>
`;
Expand All @@ -67,6 +67,10 @@ class CustomLightBrightnessRow extends Polymer.Element {
_medOnColor: String,
_highOnColor: String,
_offColor: String,
_lowText: String,
_medText: String,
_hiText: String,
_offText: String,
_isOffState: Boolean,
_isOnState: Boolean,
_isOnLow: Boolean,
Expand All @@ -92,6 +96,10 @@ class CustomLightBrightnessRow extends Polymer.Element {
IsOnMedColor: '#43A047',
IsOnHiColor: '#43A047',
ButtonInactiveColor: '#759aaa',
customOffText: 'OFF',
customLowText: 'LOW',
customMedText: 'MED',
customHiText: 'HIGH',
...config
};
}
Expand All @@ -110,6 +118,10 @@ class CustomLightBrightnessRow extends Polymer.Element {
const LowSetpoint = config.LowBrightness;
const MedSetpoint = config.MedBrightness;
const HiSetpoint = config.HiBrightness;
const custOffTxt = config.customOffText;
const custLowTxt = config.customLowText;
const custMedTxt = config.customMedText;
const custHiTxt = config.customHiText;


let lowSetpoint;
Expand Down Expand Up @@ -218,7 +230,11 @@ class CustomLightBrightnessRow extends Polymer.Element {
offcolor = 'background-color: var(--switch-unchecked-color)';
}
}


let offtext = custOffTxt;
let lowtext = custLowTxt;
let medtext = custMedTxt;
let hitext = custHiTxt;

this.setProperties({
_stateObj: stateObj,
Expand All @@ -233,6 +249,10 @@ class CustomLightBrightnessRow extends Polymer.Element {
_lowSP: lowSetpoint,
_medSP: medSetpoint,
_highSP: hiSetpoint,
_offText: offtext,
_lowText: lowtext,
_medText: medtext,
_hiText: hitext,
});
}

Expand Down

0 comments on commit 9eef4e0

Please sign in to comment.