grafana/public/sass/components/_switch.scss

137 lines
2.5 KiB
SCSS
Raw Normal View History

2016-03-21 05:07:37 -05:00
/* ============================================================
2016-03-21 07:37:56 -05:00
SWITCH 3 - YES NO
2016-03-21 05:07:37 -05:00
============================================================ */
2017-12-19 09:22:41 -06:00
gf-form-switch[disabled] {
2018-11-19 10:41:48 -06:00
.gf-form-switch,
.gf-form-switch-container {
cursor: default;
pointer-events: none !important;
2018-11-19 10:41:48 -06:00
.gf-form-label {
color: $text-color-weak;
}
}
2016-03-21 05:07:37 -05:00
}
2018-11-14 15:29:09 -06:00
.gf-form-switch-container {
display: flex;
2018-11-19 10:41:48 -06:00
cursor: pointer;
}
2018-11-14 15:29:09 -06:00
.gf-form-switch {
position: relative;
display: inline-block;
width: 60px;
2018-11-19 10:41:48 -06:00
height: $gf-form-input-height;
background: $switch-bg;
2018-11-16 14:45:19 -06:00
border: 1px solid $input-border-color;
border-left: none;
2018-11-19 10:41:48 -06:00
border-radius: $input-border-radius;
display: flex;
align-items: center;
justify-content: center;
2018-11-14 15:29:09 -06:00
input {
opacity: 0;
width: 0;
height: 0;
}
&--transparent {
background: transparent;
border: 0;
width: 40px;
}
2018-11-14 15:29:09 -06:00
}
/* The slider */
.gf-form-switch__slider {
background: $switch-slider-off-bg;
border-radius: 8px;
height: 16px;
2018-11-19 10:41:48 -06:00
width: 29px;
display: block;
position: relative;
2018-11-14 15:29:09 -06:00
&::before {
position: absolute;
content: '';
height: 12px;
width: 12px;
left: 1px;
top: 2px;
background: $switch-slider-color;
2018-11-14 15:29:09 -06:00
transition: 0.4s;
border-radius: 50%;
box-shadow: $switch-slider-shadow;
2018-11-14 15:29:09 -06:00
}
}
input:checked + .gf-form-switch__slider {
background: $switch-slider-on-bg;
2018-11-14 15:29:09 -06:00
}
input:checked + .gf-form-switch__slider::before {
transform: translateX(14px);
2018-11-14 15:29:09 -06:00
}
2018-11-20 02:39:56 -06:00
.gf-form-checkbox {
position: relative;
display: inline-block;
width: 50px;
height: $gf-form-input-height;
background: $switch-bg;
border: 1px solid $input-border-color;
border-left: none;
border-radius: $input-border-radius;
display: flex;
align-items: center;
justify-content: center;
2018-11-20 02:39:56 -06:00
input {
opacity: 0;
width: 0;
height: 0;
}
&--transparent {
background: transparent;
border: none;
width: 20px;
2018-11-20 02:39:56 -06:00
height: auto;
position: relative;
padding-left: 7px;
2018-11-20 02:39:56 -06:00
}
&--table-cell {
width: 20px;
2018-11-20 02:39:56 -06:00
background: transparent;
height: auto;
border: none;
position: relative;
top: -5px;
}
}
.gf-form-switch__checkbox {
height: 16px;
width: 16px;
border-radius: 3px;
border: $checkbox-border;
background: $checkbox-bg;
display: flex;
align-items: center;
justify-content: center;
}
2018-11-19 10:41:48 -06:00
input:checked + .gf-form-switch__checkbox::before {
font-family: 'FontAwesome';
content: '\f00c';
color: $checkbox-color;
}
input:checked + .gf-form-switch__checkbox {
background: $checkbox-checked-bg;
border: none;
}