naive-ui/styles/Switch.scss

51 lines
1.2 KiB
SCSS
Raw Normal View History

2019-06-14 11:26:46 +08:00
@import './mixins/mixins.scss';
@import './theme/default.scss';
@include b(switch) {
& {
display: inline-block;
}
.n-switch__rail {
2019-06-14 11:26:46 +08:00
position: relative;
height: 14px;
2019-08-14 19:26:40 +08:00
width: 30px;
2019-06-14 11:26:46 +08:00
border-radius: 7px;
background-color: rgba(148,151,155,0.4);
margin: 3px;
transition: background-color .2s $default-cubic-bezier;
2019-06-14 11:35:23 +08:00
&::before, &::after {
2019-06-14 11:26:46 +08:00
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);
2019-06-14 11:35:23 +08:00
transition: left .2s $default-cubic-bezier, opacity .2s $default-cubic-bezier;
}
&::before {
2019-06-14 11:26:46 +08:00
background-image: linear-gradient(52deg,rgba(148,151,155,1) 0%,rgba(148,151,155,1) 100%);
2019-06-14 11:35:23 +08:00
opacity: 1;
}
&::after {
background-image: linear-gradient(52deg,rgba(120,205,104,1) 0%,rgba(20,166,165,1) 100%);
opacity: 0;
2019-06-14 11:26:46 +08:00
}
&.n-switch__rail--active {
2019-06-14 11:26:46 +08:00
background-color: rgba(97, 196, 118, .27);
&::before {
2019-08-14 19:26:40 +08:00
left: 13px;
2019-06-14 11:35:23 +08:00
opacity: 0;
}
&::after {
2019-08-14 19:26:40 +08:00
left: 13px;
2019-06-14 11:35:23 +08:00
opacity: 1;
2019-06-14 11:26:46 +08:00
}
}
&.n-switch__rail--disabled {
cursor: not-allowed;
opacity: .5;
}
2019-06-14 11:26:46 +08:00
}
}