_switch.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. $switch-border-radius: 1rem;
  2. $switch-width: 3.5rem;
  3. $switch-height: 1.5rem;
  4. /* ============================================================
  5. SWITCH 3 - YES NO
  6. ============================================================ */
  7. .gf-form-switch {
  8. position: relative;
  9. max-width: 4.5rem;
  10. flex-grow: 1;
  11. min-width: 4.0rem;
  12. margin-right: $gf-form-margin;
  13. input {
  14. position: absolute;
  15. margin-left: -9999px;
  16. visibility: hidden;
  17. display: none;
  18. }
  19. input + label {
  20. display: block;
  21. position: relative;
  22. cursor: pointer;
  23. outline: none;
  24. user-select: none;
  25. width: 100%;
  26. height: 2.65rem;
  27. background-color: $page-bg;
  28. }
  29. input + label::before, input + label::after {
  30. @include buttonBackground($input-bg, $input-bg);
  31. display: block;
  32. position: absolute;
  33. top: 0;
  34. left: 0;
  35. bottom: 0;
  36. right: 0;
  37. color: #fff;
  38. font-size: $font-size-sm;
  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. &--table-cell {
  81. margin-bottom: 0;
  82. margin-right: 0;
  83. input + label {
  84. height: 3.6rem;
  85. }
  86. }
  87. }
  88. .gf-form-switch--search-result__section, .gf-form-switch--search-result__item {
  89. min-width: 2.6rem;
  90. input + label {
  91. background-color: inherit;
  92. height: 1.7rem;
  93. }
  94. }
  95. .gf-form-switch--search-result__section {
  96. min-width: 3.3rem;
  97. margin-right: -0.3rem;
  98. &:hover {
  99. input + label::before {
  100. @include buttonBackground($panel-bg, $panel-bg);
  101. }
  102. input + label::after {
  103. @include buttonBackground($panel-bg, $panel-bg, lighten($orange, 10%));
  104. }
  105. }
  106. input + label::before, input + label::after {
  107. @include buttonBackground($panel-bg, $panel-bg);
  108. }
  109. input + label::before {
  110. color: $gray-2
  111. }
  112. input + label::after {
  113. color: $orange
  114. }
  115. }
  116. .gf-form-switch--search-result__item {
  117. input + label {
  118. height: 2.7rem;
  119. }
  120. &:hover {
  121. input + label::before {
  122. @include buttonBackground($list-item-hover-bg, $list-item-hover-bg);
  123. }
  124. input + label::after {
  125. @include buttonBackground($list-item-hover-bg, $list-item-hover-bg);
  126. color: lighten($orange, 10%);
  127. }
  128. }
  129. input + label::before, input + label::after {
  130. @include buttonBackground($list-item-hover-bg, $list-item-hover-bg);
  131. }
  132. input + label::before {
  133. color: $gray-2
  134. }
  135. input + label::after {
  136. color: $orange
  137. }
  138. }
  139. gf-form-switch[disabled] {
  140. .gf-form-label,
  141. .gf-form-switch input + label {
  142. cursor: default;
  143. pointer-events: none !important;
  144. &::before {
  145. color: $text-color-faint;
  146. text-shadow: none;
  147. }
  148. }
  149. }