_switch.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. input {
  13. position: absolute;
  14. margin-left: -9999px;
  15. visibility: hidden;
  16. display: none;
  17. }
  18. input + label {
  19. display: block;
  20. position: relative;
  21. cursor: pointer;
  22. outline: none;
  23. user-select: none;
  24. width: 100%;
  25. height: 2.65rem;
  26. background-color: $page-bg;
  27. }
  28. input + label::before, input + label::after {
  29. @include buttonBackground($input-bg, $input-bg);
  30. display: block;
  31. position: absolute;
  32. top: 0;
  33. left: 0;
  34. bottom: 0;
  35. right: 0;
  36. color: #fff;
  37. font-size: $font-size-sm;
  38. text-align: center;
  39. line-height: 2.8rem;
  40. font-size: 150%;
  41. }
  42. &:hover {
  43. input + label::before {
  44. @include buttonBackground($input-bg, lighten($input-bg, 5%));
  45. color: $text-color;
  46. text-shadow: $text-shadow-faint;
  47. }
  48. input + label::after {
  49. @include buttonBackground($input-bg, lighten($input-bg, 5%));
  50. color: lighten($orange, 10%);
  51. text-shadow: $text-shadow-strong;
  52. }
  53. }
  54. input + label::before {
  55. font-family: 'FontAwesome';
  56. content: "\f096"; // square-o
  57. color: $text-color-weak;
  58. transition: transform 0.4s;
  59. backface-visibility: hidden;
  60. text-shadow: $text-shadow-faint;
  61. }
  62. input + label::after {
  63. content: "\f046"; // check-square-o
  64. color: $orange;
  65. text-shadow: $text-shadow-strong;
  66. font-family: 'FontAwesome';
  67. transition: transform 0.4s;
  68. transform: rotateY(180deg);
  69. backface-visibility: hidden;
  70. }
  71. input:checked + label::before {
  72. transform: rotateY(180deg);
  73. }
  74. input:checked + label::after {
  75. transform: rotateY(0);
  76. }
  77. }
  78. gf-form-switch[disabled] {
  79. .gf-form-label,
  80. .gf-form-switch input + label {
  81. cursor: default;
  82. pointer-events: none !important;
  83. }
  84. }