_switch.scss 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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[disabled] {
  89. .gf-form-label,
  90. .gf-form-switch input + label {
  91. cursor: default;
  92. pointer-events: none !important;
  93. &::before {
  94. color: $text-color-faint;
  95. text-shadow: none;
  96. }
  97. }
  98. }