_switch.scss 2.5 KB

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