grafana/public/sass/components/_switch.scss

116 lines
2.7 KiB
SCSS
Raw Normal View History

2016-03-21 05:07:37 -05:00
$switch-border-radius: 1rem;
$switch-width: 3.5rem;
$switch-height: 1.5rem;
/* ============================================================
COMMON
============================================================ */
.cmn-toggle {
position: absolute;
margin-left: -9999px;
visibility: hidden;
}
.cmn-toggle + label {
display: block;
position: relative;
cursor: pointer;
outline: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
/* ============================================================
SWITCH 1 - ROUND
============================================================ */
input.cmn-toggle-round + label {
padding: 2px;
width: $switch-width;
height: $switch-height;
background-color: $dark-1;
border-radius: $switch-border-radius;
}
input.cmn-toggle-round + label:before, input.cmn-toggle-round + label:after {
display: block;
position: absolute;
top: 1px;
left: 1px;
bottom: 1px;
content: "";
}
input.cmn-toggle-round + label:before {
right: 1px;
background-color: $card-background;
border-radius: $switch-border-radius;
box-shadow: $card-shadow;
transition: background 0.4s;
}
input.cmn-toggle-round + label:after {
width: $switch-height;
background-color: $dark-5;
border-radius: 100%;
box-shadow: $card-shadow;
transition: margin 0.4s;
}
input.cmn-toggle-round:checked + label:before {
background-color: $blue;
}
input.cmn-toggle-round:checked + label:after {
margin-left: $switch-width - $switch-height;
}
/* ============================================================
SWITCH 3 - YES NO
============================================================ */
input.cmn-toggle-yes-no + label {
padding: 2px;
2016-03-21 05:27:53 -05:00
width: 5rem;
height: 2.6rem;
padding: $input-padding-y $input-padding-x;
background-color: $input-bg;
2016-03-21 05:07:37 -05:00
}
2016-03-21 05:27:53 -05:00
2016-03-21 05:07:37 -05:00
input.cmn-toggle-yes-no + label:before, input.cmn-toggle-yes-no + label:after {
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
color: #fff;
2016-03-21 05:27:53 -05:00
font-family: "Open Sans";
font-size: $font-size-sm;
2016-03-21 05:07:37 -05:00
text-align: center;
2016-03-21 05:27:53 -05:00
line-height: 2.6rem;
2016-03-21 05:07:37 -05:00
}
2016-03-21 05:27:53 -05:00
2016-03-21 05:07:37 -05:00
input.cmn-toggle-yes-no + label:before {
2016-03-21 05:27:53 -05:00
@include buttonBackground($btn-inverse-bg, $btn-inverse-bg-hl);
2016-03-21 05:07:37 -05:00
content: attr(data-off);
transition: transform 0.5s;
backface-visibility: hidden;
}
2016-03-21 05:27:53 -05:00
2016-03-21 05:07:37 -05:00
input.cmn-toggle-yes-no + label:after {
2016-03-21 05:27:53 -05:00
//@include buttonBackground($btn-success-bg, $btn-success-bg-hl);
@include buttonBackground($btn-secondary-bg, $btn-secondary-bg-hl);
2016-03-21 05:07:37 -05:00
content: attr(data-on);
transition: transform 0.5s;
transform: rotateY(180deg);
backface-visibility: hidden;
}
2016-03-21 05:27:53 -05:00
2016-03-21 05:07:37 -05:00
input.cmn-toggle-yes-no:checked + label:before {
transform: rotateY(180deg);
}
2016-03-21 05:27:53 -05:00
2016-03-21 05:07:37 -05:00
input.cmn-toggle-yes-no:checked + label:after {
transform: rotateY(0);
}