_switch.scss 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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--transparent {
  89. input + label {
  90. background: transparent;
  91. }
  92. input + label::before, input + label::after {
  93. background: transparent;
  94. }
  95. &:hover {
  96. input + label::before {
  97. background: transparent;
  98. }
  99. input + label::after {
  100. background: transparent;
  101. }
  102. }
  103. }
  104. .gf-form-switch--search-result__section {
  105. min-width: 3.3rem;
  106. margin-right: -0.3rem;
  107. input + label {
  108. height: 1.7rem;
  109. }
  110. }
  111. .gf-form-switch--search-result__item {
  112. min-width: 2.6rem;
  113. input + label {
  114. height: 2.7rem;
  115. }
  116. }
  117. .gf-form-switch--search-result-filter-row__checkbox {
  118. min-width: 4.7rem;
  119. input + label {
  120. height: 2.5rem;
  121. }
  122. }
  123. gf-form-switch[disabled] {
  124. .gf-form-label,
  125. .gf-form-switch input + label {
  126. cursor: default;
  127. pointer-events: none !important;
  128. &::before {
  129. color: $text-color-faint;
  130. text-shadow: none;
  131. }
  132. }
  133. }