_switch.scss 2.5 KB

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