_switch.scss 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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-faint;
  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. }