buttons: add colored border for on state

This commit is contained in:
jean-emmanuel 2017-07-12 09:22:24 +02:00
parent a149586571
commit 7bba3d0d21
6 changed files with 70 additions and 18 deletions

View file

@ -45,6 +45,7 @@ module.exports = class Toggle extends _widgets_base {
this.fakeclick()
})
this.classHolders = this.widget.add(this.container)
this.value = this.getProp('off')
@ -68,12 +69,12 @@ module.exports = class Toggle extends _widgets_base {
setValue(v,options={}) {
if (v===this.getProp('on') || (this.getProp('on') != null && v.value === this.getProp('on').value && v.value !== undefined)) {
this.widget.addClass('on')
this.classHolders.addClass('on')
this.widget.state = 1
this.value = this.getProp('on')
if (options.send) this.sendValue()
} else if (v===this.getProp('off') || (this.getProp('off') != null && v.value === this.getProp('off').value && v.value !== undefined)) {
this.widget.removeClass('on')
this.classHolders.removeClass('on')
this.widget.state = 0
this.value = this.getProp('off')
if (options.send) this.sendValue()

View file

@ -85,6 +85,8 @@ body {
width:100%;
-webkit-mask: linear-gradient(to left, rgba(0, 0, 0, 0), #000000 10rem) no-repeat;
}
}
&.on a, .sidepanel-open {
position: relative;
@ -101,6 +103,17 @@ body {
opacity: 0.35;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {
content:"";
position: absolute;
top:0;
left: 0;
right: 0;
bottom: 0;
opacity: 0.3;
box-shadow: 0 0 0 1rem var(--color-custom) inset;
border-radius: inherit;
}
}
}
.parent + li a {

View file

@ -108,6 +108,17 @@
opacity: 0.35;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {
content:"";
position: absolute;
top:0;
left: 0;
right: 0;
bottom: 0;
opacity: 0.3;
box-shadow: 0 0 0 1rem var(--color-custom) inset;
border-radius: inherit;
}
}
}

View file

@ -17,14 +17,9 @@
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
}
&.on .light:before {
opacity: 0.3;
}
.light:after{
display: none;
}
}
&.on > .label {
color: var(--color-custom)
}
}

View file

@ -61,6 +61,18 @@
justify-content: center;
box-shadow: 0 0 0 1rem var(--color-light) inset;
&:before {
content:"";
position: absolute;
top:0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
box-shadow: 0 0 0 1rem var(--color-custom) inset;
border-radius: inherit;
}
&.on {
// background: var(--color-fg);
color: var(--color-custom);
@ -74,6 +86,9 @@
opacity: 0.35;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
&:before {
opacity: 0.3
}
}
&:first-child {
// border-top:0;

View file

@ -22,8 +22,16 @@
pointer-events: none;
border-radius: inherit;
&:after {
&:before {
content:"";
flex:1;
opacity: 0;
box-shadow: 0 0 0 1rem var(--color-custom) inset;
border-radius: inherit;
}
&:after {
// content:"";
opacity: 1;
position: absolute;
display: block;
@ -37,29 +45,34 @@
border-radius: inherit;
}
&:before {
content:"";
flex:1;
opacity: 0;
box-shadow: 0 0 0 1rem var(--color-custom) inset;
border-radius: inherit;
}
}
&.on {
&:after {
content: "";
position: absolute;
top:0;
left: 0;
right: 0;
bottom: 0;
opacity: 0.35;
background: radial-gradient( ellipse at center, transparent, var(--color-bg));
}
.light:before {
opacity: 0.3;
}
.light:after {
background: var(--color-custom);
}
}
}
> .label {
position: absolute;
top:7rem;
top:2rem;
left:2rem;
right:2rem;
bottom:2rem;
@ -76,4 +89,8 @@
z-index: 2;
}
&.on > .label {
color: var(--color-custom)
}
}