_switch.scss 3.0 KB

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