_switch.scss 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* ============================================================
  2. SWITCH 3 - YES NO
  3. ============================================================ */
  4. gf-form-switch[disabled] {
  5. .gf-form-switch,
  6. .gf-form-switch-container {
  7. cursor: default;
  8. pointer-events: none !important;
  9. .gf-form-label {
  10. color: $text-color-weak;
  11. }
  12. }
  13. }
  14. .gf-form-switch-container {
  15. display: flex;
  16. cursor: pointer;
  17. }
  18. .gf-form-switch {
  19. position: relative;
  20. display: inline-block;
  21. width: 60px;
  22. height: $gf-form-input-height;
  23. background: $switch-bg;
  24. border: 1px solid $input-border-color;
  25. border-left: none;
  26. border-radius: $input-border-radius;
  27. input {
  28. opacity: 0;
  29. width: 0;
  30. height: 0;
  31. }
  32. &--transparent {
  33. background: transparent;
  34. border: none;
  35. }
  36. &--search-result__section {
  37. width: 3.05rem;
  38. height: auto;
  39. position: relative;
  40. top: -5px;
  41. left: 3px;
  42. }
  43. &--search-result__item {
  44. width: 2.7rem;
  45. height: auto;
  46. position: relative;
  47. top: 3px;
  48. }
  49. &--table-cell {
  50. width: 40px;
  51. background: transparent;
  52. height: auto;
  53. border: none;
  54. position: relative;
  55. top: -5px;
  56. }
  57. }
  58. /* The slider */
  59. .gf-form-switch__slider {
  60. position: absolute;
  61. top: 8px;
  62. left: 16px;
  63. right: 14px;
  64. bottom: 10px;
  65. background: $switch-slider-off-bg;
  66. border-radius: 8px;
  67. height: 16px;
  68. width: 29px;
  69. &::before {
  70. position: absolute;
  71. content: '';
  72. height: 12px;
  73. width: 12px;
  74. left: 2px;
  75. bottom: 2px;
  76. background: $switch-slider-color;
  77. transition: 0.4s;
  78. border-radius: 50%;
  79. box-shadow: $switch-slider-shadow;
  80. }
  81. }
  82. input:checked + .gf-form-switch__slider {
  83. background: $switch-slider-on-bg;
  84. }
  85. input:checked + .gf-form-switch__slider::before {
  86. transform: translateX(14px);
  87. }
  88. .gf-form-switch__checkbox {
  89. position: absolute;
  90. left: 16px;
  91. height: 16px;
  92. width: 16px;
  93. border-radius: 3px;
  94. border: $checkbox-border;
  95. background: $checkbox-bg;
  96. top: 8px;
  97. display: flex;
  98. justify-content: center;
  99. align-items: center;
  100. }
  101. input:checked + .gf-form-switch__checkbox::before {
  102. font-family: 'FontAwesome';
  103. content: '\f00c';
  104. color: $checkbox-color;
  105. }
  106. input:checked + .gf-form-switch__checkbox {
  107. background: $checkbox-checked-bg;
  108. border: none;
  109. }