UNPKG

@nutui/nutui-react-taro

Version:

京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序

96 lines 2.02 kB
/* #ifdef harmony */ /* #endif */ /* #ifndef harmony */ /* #endif */ .nut-switch { cursor: pointer; position: relative; display: inline-flex; flex-direction: row; align-items: center; min-width: 46px; height: 28px; line-height: 28px; background-color: #ff0f23; border-radius: 50px; background-size: 100% 100%; background-repeat: no-repeat; background-position: center center; flex: 0 0 auto; } .nut-switch-button { position: absolute; top: 50%; transform: translateY(-50%); display: flex; flex-direction: row; align-items: center; justify-content: center; height: calc(28px - 2px * 2); width: calc(28px - 2px * 2); border-radius: 50%; background: #ffffff; transition: left 0.3s linear; box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.1); } .nut-switch-button-open { left: calc(100% - 28px + 2px); } .nut-switch-button-open-rtl { left: 2px; } .nut-switch-button-close { left: 2px; } .nut-switch-button-close-rtl { left: calc(100% - 28px + 2px); } .nut-switch-button .nut-icon { width: calc((28px - 2px * 2) / 2); height: calc((28px - 2px * 2) / 2); color: #ffadbe; } .nut-switch-close { background-color: #c2c4cc; } .nut-switch-close-line { width: calc((28px - 2px * 2) / 2); height: 2px; background: #ffffff; border-radius: 2px; } .nut-switch-label { display: inline-flex; align-items: center; height: 100%; white-space: nowrap; color: #ffffff; font-size: 12px; } .nut-switch-label .nut-icon { color: #ffffff; } .nut-switch-label-open { margin: 0 calc(28px - 2px + 3px) 0 7px; } .nut-switch-label-open-rtl { margin: 0 7px 0 calc(28px - 2px + 3px); } .nut-switch-label-close { margin: 0 7px 0 calc(28px - 2px + 3px); } .nut-switch-label-close-rtl { margin: 0 calc(28px - 2px + 3px) 0 7px; } .nut-switch-label-close-disabled { color: #c2c4cc; } .nut-switch-label-close-disabled .nut-icon { color: #c2c4cc; } .nut-switch-disabled { background-color: #ffadbe; } .nut-switch-disabled-close { background-color: #f2f3f5; }