grafana/public/sass/components/_switch.scss
2018-06-28 03:02:49 -07:00

164 lines
3.0 KiB
SCSS

/* ============================================================
SWITCH 3 - YES NO
============================================================ */
.gf-form-switch {
position: relative;
max-width: 4.5rem;
flex-grow: 1;
min-width: 4rem;
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: 37px;
background: $input-bg;
border: 1px solid $input-border-color;
border-left: none;
border-radius: $input-border-radius;
}
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--transparent {
input + label {
background: transparent;
border: none;
}
input + label::before,
input + label::after {
background: transparent;
border: none;
}
&:hover {
input + label::before {
background: transparent;
}
input + label::after {
background: transparent;
}
}
}
.gf-form-switch--search-result__section {
min-width: 3.05rem;
margin-right: -0.3rem;
input + label {
height: 1.7rem;
}
}
.gf-form-switch--search-result__item {
min-width: 2.7rem;
input + label {
height: 2.7rem;
}
}
.gf-form-switch--search-result-filter-row__checkbox {
min-width: 3.75rem;
input + label {
height: 2.5rem;
}
}
gf-form-switch[disabled] {
.gf-form-label,
.gf-form-switch input + label {
cursor: default;
pointer-events: none !important;
&::before,
&::after {
color: $text-color-faint;
text-shadow: none;
}
}
}