_switch.scss 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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-react {
  15. display: flex;
  16. }
  17. .gf-form-switch-container {
  18. display: flex;
  19. cursor: pointer;
  20. }
  21. .gf-form-switch {
  22. display: flex;
  23. position: relative;
  24. width: 60px;
  25. height: $gf-form-input-height;
  26. background: $switch-bg;
  27. border: 1px solid $input-border-color;
  28. border-left: none;
  29. border-radius: $input-border-radius;
  30. align-items: center;
  31. justify-content: center;
  32. input {
  33. opacity: 0;
  34. width: 0;
  35. height: 0;
  36. }
  37. &--transparent {
  38. background: transparent;
  39. border: 0;
  40. width: 40px;
  41. }
  42. }
  43. /* The slider */
  44. .gf-form-switch__slider {
  45. background: $switch-slider-off-bg;
  46. border-radius: 8px;
  47. height: 16px;
  48. width: 29px;
  49. display: block;
  50. position: relative;
  51. &::before {
  52. position: absolute;
  53. content: '';
  54. height: 12px;
  55. width: 12px;
  56. left: 1px;
  57. top: 2px;
  58. background: $switch-slider-color;
  59. transition: 0.4s;
  60. border-radius: 50%;
  61. box-shadow: $switch-slider-shadow;
  62. }
  63. }
  64. input:checked + .gf-form-switch__slider {
  65. background: $switch-slider-on-bg;
  66. }
  67. input:checked + .gf-form-switch__slider::before {
  68. transform: translateX(14px);
  69. }
  70. .gf-form-checkbox {
  71. position: relative;
  72. display: flex;
  73. width: 50px;
  74. height: $gf-form-input-height;
  75. background: $switch-bg;
  76. border: 1px solid $input-border-color;
  77. border-left: none;
  78. border-radius: $input-border-radius;
  79. align-items: center;
  80. justify-content: center;
  81. input {
  82. opacity: 0;
  83. width: 0;
  84. height: 0;
  85. }
  86. &--transparent {
  87. background: transparent;
  88. border: none;
  89. width: 23px;
  90. height: auto;
  91. position: relative;
  92. padding-left: 8px;
  93. }
  94. &--table-cell {
  95. width: 20px;
  96. background: transparent;
  97. height: auto;
  98. border: none;
  99. position: relative;
  100. top: -5px;
  101. }
  102. }
  103. .gf-form-switch__checkbox {
  104. height: 16px;
  105. width: 16px;
  106. border-radius: 3px;
  107. border: $checkbox-border;
  108. background: $checkbox-bg;
  109. display: flex;
  110. align-items: center;
  111. justify-content: center;
  112. }
  113. input:checked + .gf-form-switch__checkbox::before {
  114. font-family: 'FontAwesome';
  115. content: '\f00c';
  116. color: $checkbox-color;
  117. }
  118. input:checked + .gf-form-switch__checkbox {
  119. background: $checkbox-checked-bg;
  120. border: none;
  121. }