mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-20 12:28:10 +08:00
118 lines
2.1 KiB
Plaintext
118 lines
2.1 KiB
Plaintext
@import "../../style/themes/default";
|
|
@import "../../style/mixins/index";
|
|
|
|
@switch-prefix-cls: ~"@{ant-prefix}-switch";
|
|
@switch-duration: .36s;
|
|
|
|
.@{switch-prefix-cls} {
|
|
.reset-component;
|
|
position: relative;
|
|
display: inline-block;
|
|
box-sizing: border-box;
|
|
height: @switch-height;
|
|
min-width: 44px;
|
|
line-height: @switch-height - 2px;
|
|
vertical-align: middle;
|
|
border-radius: 100px;
|
|
border: 1px solid transparent;
|
|
background-color: @disabled-color;
|
|
cursor: pointer;
|
|
transition: all @switch-duration;
|
|
user-select: none;
|
|
|
|
&-inner {
|
|
color: #fff;
|
|
font-size: @font-size-sm;
|
|
margin-left: 24px;
|
|
margin-right: 6px;
|
|
display: block;
|
|
}
|
|
|
|
&:after {
|
|
position: absolute;
|
|
width: @switch-height - 4px;
|
|
height: @switch-height - 4px;
|
|
left: 1px;
|
|
top: 1px;
|
|
|
|
border-radius: 18px;
|
|
background-color: @component-background;
|
|
content: " ";
|
|
cursor: pointer;
|
|
transition: all @switch-duration @ease-in-out-circ;
|
|
}
|
|
|
|
&:active:after {
|
|
width: 24px;
|
|
}
|
|
|
|
&:focus {
|
|
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
|
|
outline: 0;
|
|
}
|
|
|
|
&:focus:hover {
|
|
box-shadow: none;
|
|
}
|
|
|
|
&-small {
|
|
height: @switch-sm-height;
|
|
min-width: 28px;
|
|
line-height: @switch-sm-height - 2px;
|
|
|
|
.@{switch-prefix-cls}-inner {
|
|
margin-left: 18px;
|
|
margin-right: 3px;
|
|
font-size: @font-size-sm;
|
|
}
|
|
|
|
&:after {
|
|
width: @switch-sm-height - 4px;
|
|
height: @switch-sm-height - 4px;
|
|
}
|
|
|
|
&:active:after {
|
|
width: 16px;
|
|
}
|
|
}
|
|
|
|
&-small&-checked {
|
|
&:after {
|
|
left: 100%;
|
|
margin-left: -12.5px;
|
|
}
|
|
|
|
.@{switch-prefix-cls}-inner {
|
|
margin-left: 3px;
|
|
margin-right: 18px;
|
|
}
|
|
}
|
|
|
|
&-small:active&-checked:after {
|
|
margin-left: -16.5px;
|
|
}
|
|
|
|
&-checked {
|
|
background-color: @primary-color;
|
|
|
|
.@{switch-prefix-cls}-inner {
|
|
margin-left: 6px;
|
|
margin-right: 24px;
|
|
}
|
|
|
|
&:after {
|
|
left: 100%;
|
|
margin-left: -19px;
|
|
}
|
|
|
|
&:active:after {
|
|
margin-left: -25px;
|
|
}
|
|
}
|
|
|
|
&-disabled {
|
|
cursor: not-allowed;
|
|
opacity: 0.35;
|
|
}
|
|
}
|