_switch.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /* ============================================================
  2. SWITCH 3 - YES NO
  3. ============================================================ */
  4. .gf-form-switch {
  5. &--small {
  6. max-width: 2rem;
  7. min-width: 1.5rem;
  8. input + label {
  9. height: 25px;
  10. }
  11. input + label::before,
  12. input + label::after {
  13. font-size: $font-size-sm;
  14. }
  15. }
  16. &--table-cell {
  17. margin-bottom: 0;
  18. margin-right: 0;
  19. input + label {
  20. height: 3.6rem;
  21. }
  22. }
  23. }
  24. .gf-form-switch--transparent {
  25. input + label {
  26. background: transparent;
  27. border: none;
  28. }
  29. input + label::before,
  30. input + label::after {
  31. background: transparent;
  32. border: none;
  33. }
  34. &:hover {
  35. input + label::before {
  36. background: transparent;
  37. }
  38. input + label::after {
  39. background: transparent;
  40. }
  41. }
  42. }
  43. .gf-form-switch--search-result__section {
  44. min-width: 3.05rem;
  45. margin-right: -0.3rem;
  46. input + label {
  47. height: 1.7rem;
  48. }
  49. }
  50. .gf-form-switch--search-result__item {
  51. min-width: 2.7rem;
  52. input + label {
  53. height: 2.7rem;
  54. }
  55. }
  56. .gf-form-switch--search-result-filter-row__checkbox {
  57. min-width: 3.75rem;
  58. input + label {
  59. height: 2.5rem;
  60. }
  61. }
  62. gf-form-switch[disabled] {
  63. .gf-form-label,
  64. .gf-form-switch input + label {
  65. cursor: default;
  66. pointer-events: none !important;
  67. &::before,
  68. &::after {
  69. color: $text-color-faint;
  70. text-shadow: none;
  71. }
  72. }
  73. }
  74. .gf-form-switch-container {
  75. display: flex;
  76. }
  77. .gf-form-switch {
  78. position: relative;
  79. display: inline-block;
  80. width: 60px;
  81. height: 34px;
  82. background: $switch-bg;
  83. border: 1px solid $input-border-color;
  84. border-left: none;
  85. input {
  86. opacity: 0;
  87. width: 0;
  88. height: 0;
  89. }
  90. }
  91. /* The slider */
  92. .gf-form-switch__slider {
  93. position: absolute;
  94. top: 8px;
  95. left: 16px;
  96. right: 14px;
  97. bottom: 10px;
  98. background: $switch-slider-off-bg;
  99. border-radius: 8px;
  100. height: 16px;
  101. &::before {
  102. position: absolute;
  103. content: '';
  104. height: 12px;
  105. width: 12px;
  106. left: 2px;
  107. bottom: 2px;
  108. background: $switch-slider-color;
  109. transition: 0.4s;
  110. border-radius: 50%;
  111. box-shadow: $switch-slider-shadow;
  112. }
  113. }
  114. input:checked + .gf-form-switch__slider {
  115. background: $switch-slider-on-bg;
  116. }
  117. /* input:focus + .gf-form-switch__slider { */
  118. /* box-shadow: 0 0 1px #2196f3; */
  119. /* } */
  120. input:checked + .gf-form-switch__slider::before {
  121. transform: translateX(14px);
  122. }
  123. /* The Checkbox */
  124. .gf-form-switch__checkbox {
  125. position: absolute;
  126. left: 16px;
  127. height: 16px;
  128. width: 16px;
  129. border-radius: 3px;
  130. border: $checkbox-border;
  131. background: $checkbox-bg;
  132. top: 8px;
  133. display: flex;
  134. justify-content: center;
  135. align-items: center;
  136. }
  137. input:checked + .gf-form-switch__checkbox::before {
  138. font-family: 'FontAwesome';
  139. content: '\f00c';
  140. color: $checkbox-color;
  141. }
  142. input:checked + .gf-form-switch__checkbox {
  143. background: $checkbox-checked-bg;
  144. border: none;
  145. }