_switch.scss 3.2 KB

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