Skip to content

Commit

Permalink
add hide stop button option
Browse files Browse the repository at this point in the history
  • Loading branch information
finity69x2 authored Dec 1, 2020
1 parent d795bb9 commit d8ec73a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion dist/cover-control-button-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CustomCoverControlRow extends Polymer.Element {
disabled='[[_leftPosition]]'>[[_leftText]]</button>
<button
class='position'
style='[[_stopColor]]'
style='[[_stopColor]];[[_hideStop]]'
toggles name="[[_stopName]]"
on-click='setPosition'>[[_stopText]]</button>
<button
Expand Down Expand Up @@ -85,6 +85,7 @@ class CustomCoverControlRow extends Polymer.Element {
_rightName: String,
_leftPosition: Boolean,
_rightPosition: Boolean,
_hideStop: Boolean,
}
}

Expand All @@ -94,6 +95,7 @@ class CustomCoverControlRow extends Polymer.Element {
this._config = {
customTheme: false,
reverseButtons: false,
hideStopButton: false,
//openButtonColor: '#43A047',
stopButtonColor: '#c94444',
//closeButtonColor: '#f44c09',
Expand All @@ -116,6 +118,7 @@ class CustomCoverControlRow extends Polymer.Element {
const stateObj = hass.states[config.entity];
const custTheme = config.customTheme;
const revButtons = config.reverseButtons;
const hideStpBtn = config.hideStopButton;
//const opnButtonClr = config.openButtonColor;
const stpButtonClr = config.stopButtonColor;
//const clsButtonClr = config.closeButtonColor;
Expand Down Expand Up @@ -189,6 +192,14 @@ class CustomCoverControlRow extends Polymer.Element {
let stopname = 'stop';
let closename = 'close';

let hidestop = 'display:block';

if (hideStpBtn) {
hidestop = 'display:none';
} else {
hidestop = 'display:block';
}


if (revButtons) {
this.setProperties({
Expand All @@ -208,6 +219,7 @@ class CustomCoverControlRow extends Polymer.Element {
_leftName: openname,
_stopName: stopname,
_rightName: closename,
_hideStop: hidestop,
});
} else {
this.setProperties({
Expand All @@ -227,6 +239,7 @@ class CustomCoverControlRow extends Polymer.Element {
_leftName: closename,
_stopName: stopname,
_rightName: openname,
_hideStop: hidestop,
});
}
}
Expand Down

0 comments on commit d8ec73a

Please sign in to comment.