_switch.scss 2.4 KB

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