grafana/public/sass/components/_switch.scss

116 lines
2.3 KiB
SCSS

$switch-border-radius: 1rem;
$switch-width: 3.5rem;
$switch-height: 1.5rem;
/* ============================================================
SWITCH 3 - YES NO
============================================================ */
.gf-form-switch {
position: relative;
max-width: 4.5rem;
flex-grow: 1;
min-width: 4.0rem;
margin-right: $gf-form-margin;
input {
position: absolute;
margin-left: -9999px;
visibility: hidden;
display: none;
}
input + label {
display: block;
position: relative;
cursor: pointer;
outline: none;
user-select: none;
width: 100%;
height: 2.65rem;
background-color: $page-bg;
}
input + label::before, input + label::after {
@include buttonBackground($input-bg, $input-bg);
display: block;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
color: #fff;
font-size: $font-size-sm;
text-align: center;
font-size: 150%;
display: flex;
flex-direction: column;
justify-content: center;
}
&:hover {
input + label::before {
@include buttonBackground($input-bg, lighten($input-bg, 5%));
color: $text-color;
text-shadow: $text-shadow-faint;
}
input + label::after {
@include buttonBackground($input-bg, lighten($input-bg, 5%));
color: lighten($orange, 10%);
text-shadow: $text-shadow-strong;
}
}
input + label::before {
font-family: 'FontAwesome';
content: "\f096"; // square-o
color: $text-color-weak;
transition: transform 0.4s;
backface-visibility: hidden;
text-shadow: $text-shadow-faint;
}
input + label::after {
content: "\f046"; // check-square-o
color: $orange;
text-shadow: $text-shadow-strong;
font-family: 'FontAwesome';
transition: transform 0.4s;
transform: rotateY(180deg);
backface-visibility: hidden;
}
input:checked + label::before {
transform: rotateY(180deg);
}
input:checked + label::after {
transform: rotateY(0);
}
&--table-cell {
margin-bottom: 0;
margin-right: 0;
input + label {
height: 3.6rem;
}
}
}
gf-form-switch[disabled] {
.gf-form-label,
.gf-form-switch input + label {
cursor: default;
pointer-events: none !important;
&::before {
color: $text-color-faint;
text-shadow: none;
}
}
}