naive-ui/styles/Switch.scss
2019-06-25 16:54:51 +08:00

51 lines
1.2 KiB
SCSS

@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(switch) {
& {
display: inline-block;
}
.n-switch__rail {
position: relative;
height: 14px;
width: 28px;
border-radius: 7px;
background-color: rgba(148,151,155,0.4);
margin: 3px;
transition: background-color .2s $default-cubic-bezier;
&::before, &::after {
content: "";
position: absolute;
height: 20px;
width: 20px;
border-radius: 10px;
top: -3px;
left: -3px;
box-shadow:0px 2px 4px 0px rgba(0,0,0,0.4);
transition: left .2s $default-cubic-bezier, opacity .2s $default-cubic-bezier;
}
&::before {
background-image: linear-gradient(52deg,rgba(148,151,155,1) 0%,rgba(148,151,155,1) 100%);
opacity: 1;
}
&::after {
background-image: linear-gradient(52deg,rgba(120,205,104,1) 0%,rgba(20,166,165,1) 100%);
opacity: 0;
}
&.n-switch__rail--active {
background-color: rgba(97, 196, 118, .27);
&::before {
left: 12px;
opacity: 0;
}
&::after {
left: 12px;
opacity: 1;
}
}
&.n-switch__rail--disabled {
cursor: not-allowed;
opacity: .5;
}
}
}