UNPKG

rc-switch

Version:

switch ui component for react

116 lines (111 loc) 2.25 kB
.rc-switch { position: relative; display: inline-block; width: 38px; height: 20px; line-height: 20px; vertical-align: middle; border-radius: 20px 20px; border: 1px solid @grey-300; background-color: @grey-300; cursor: pointer; transition: all 0.3s @fc-ease-in-out; &:after { display: block; position: absolute; top: -1px; left: -1px; width: 20px; height: 20px; border-radius: 50% 50%; background-color: @white; content: " "; cursor: pointer; box-shadow: @fc-shadow-z1; -webkit-transform: scale(1); transition: left 0.3s @fc-ease-in-out; -webkit-animation-timing-function: @fc-ease-in-out; -webkit-animation-duration: 0.3s; animation-timing-function: @fc-ease-in-out; animation-duration: 0.3s; -webkit-animation-name: amSwitchOff; animation-name: amSwitchOff; } &:hover:after { -webkit-transform: scale(1.1); transform: scale(1.1); -webkit-animation-name: amSwitchOn; animation-name: amSwitchOn; } } .rc-switch-checked/*:not([disabled])*/ { border: 1px solid @blue-300; background-color: @blue-300; &:after { left: 18px; } } .rc-switch-disabled { cursor: no-drop; &:after { background: @grey-500; -webkit-animation-name: none; animation-name: none; cursor: no-drop; } &:hover:after { -webkit-transform: scale(1); transform: scale(1); -webkit-animation-name: none; animation-name: none; } } .rc-switch-label { display: inline-block; line-height: 20px; font-size: 14px; padding-left: 10px; vertical-align: middle; white-space: normal; pointer-events: none; -webkit-user-select: text; user-select: text; } @-webkit-keyframes amSwitchOn { 0% { -webkit-transform: scale(1); } 50% { -webkit-transform: scale(1.25); } 100% { -webkit-transform: scale(1.1); } } @keyframes amSwitchOn { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1.1); } } @-webkit-keyframes amSwitchOff { 0% { -webkit-transform: scale(1.1); } 100% { -webkit-transform: scale(1); } } @keyframes amSwitchOff { 0% { transform: scale(1.1); } 100% { transform: scale(1); } }