_switch.scss 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. font-size: $font-size-sm;
  40. text-align: center;
  41. font-size: 150%;
  42. display: flex;
  43. flex-direction: column;
  44. justify-content: center;
  45. }
  46. &:hover {
  47. input + label::before {
  48. @include buttonBackground($input-bg, lighten($input-bg, 5%));
  49. color: $text-color;
  50. text-shadow: $text-shadow-faint;
  51. }
  52. input + label::after {
  53. @include buttonBackground($input-bg, lighten($input-bg, 5%));
  54. color: lighten($orange, 10%);
  55. text-shadow: $text-shadow-strong;
  56. }
  57. }
  58. input + label::before {
  59. font-family: "FontAwesome";
  60. content: "\f096"; // square-o
  61. color: $text-color-weak;
  62. transition: transform 0.4s;
  63. backface-visibility: hidden;
  64. text-shadow: $text-shadow-faint;
  65. }
  66. input + label::after {
  67. content: "\f046"; // check-square-o
  68. color: $orange;
  69. text-shadow: $text-shadow-strong;
  70. font-family: "FontAwesome";
  71. transition: transform 0.4s;
  72. transform: rotateY(180deg);
  73. backface-visibility: hidden;
  74. }
  75. input:checked + label::before {
  76. transform: rotateY(180deg);
  77. }
  78. input:checked + label::after {
  79. transform: rotateY(0);
  80. }
  81. &--table-cell {
  82. margin-bottom: 0;
  83. margin-right: 0;
  84. input + label {
  85. height: 3.6rem;
  86. }
  87. }
  88. }
  89. .gf-form-switch--transparent {
  90. input + label {
  91. background: transparent;
  92. border: none;
  93. }
  94. input + label::before,
  95. input + label::after {
  96. background: transparent;
  97. border: none;
  98. }
  99. &:hover {
  100. input + label::before {
  101. background: transparent;
  102. }
  103. input + label::after {
  104. background: transparent;
  105. }
  106. }
  107. }
  108. .gf-form-switch--search-result__section {
  109. min-width: 3.05rem;
  110. margin-right: -0.3rem;
  111. input + label {
  112. height: 1.7rem;
  113. }
  114. }
  115. .gf-form-switch--search-result__item {
  116. min-width: 2.7rem;
  117. input + label {
  118. height: 2.7rem;
  119. }
  120. }
  121. .gf-form-switch--search-result-filter-row__checkbox {
  122. min-width: 3.75rem;
  123. input + label {
  124. height: 2.5rem;
  125. }
  126. }
  127. gf-form-switch[disabled] {
  128. .gf-form-label,
  129. .gf-form-switch input + label {
  130. cursor: default;
  131. pointer-events: none !important;
  132. &::before {
  133. color: $text-color-faint;
  134. text-shadow: none;
  135. }
  136. }
  137. }