input-switch.less 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .input-switch {
  2. display: inline-block;
  3. padding-left: 5px;
  4. }
  5. .input-switch-hidden-input {
  6. display: none;
  7. + .input-switch-btn {
  8. display: block;
  9. width: 34px;
  10. height: 20px;
  11. position: relative;
  12. outline: 0;
  13. margin: 0;
  14. font-weight: normal;
  15. cursor: pointer;
  16. user-select: none;
  17. padding: 1px;
  18. background-color: @rp-highlight-blue;
  19. border-radius: 0.875em;
  20. transition:
  21. background 0.15s ease,
  22. border-color 0.15s ease;
  23. &::before {
  24. content: '';
  25. display: block;
  26. width: 16px;
  27. height: 16px;
  28. position: relative;
  29. left: 1px;
  30. top: 1px;
  31. background-color: #fff;
  32. border-radius: 0.875em;
  33. transition:
  34. background-color 0.15s ease,
  35. color 0.15s ease,
  36. left 0.15s ease;
  37. }
  38. }
  39. &:checked + .input-switch-btn {
  40. background-color: @ol-green;
  41. border-color: #fff;
  42. &::before {
  43. left: 15px;
  44. top: 1px;
  45. }
  46. }
  47. &:disabled + .input-switch-btn {
  48. cursor: default;
  49. opacity: 0.35;
  50. }
  51. }