| 1 |
// Mixins |
| 2 |
%reactToggle { |
| 3 |
.react-toggle { |
| 4 |
touch-action: pan-x; |
| 5 |
display: inline-block; |
| 6 |
position: relative; |
| 7 |
cursor: pointer; |
| 8 |
background-color: transparent; |
| 9 |
border: 0; |
| 10 |
padding: 0; |
| 11 |
-webkit-touch-callout: none; |
| 12 |
-webkit-user-select: none; |
| 13 |
-khtml-user-select: none; |
| 14 |
-moz-user-select: none; |
| 15 |
-ms-user-select: none; |
| 16 |
user-select: none; |
| 17 |
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); |
| 18 |
-webkit-tap-highlight-color: transparent; |
| 19 |
} |
| 20 |
|
| 21 |
.react-toggle-screenreader-only { |
| 22 |
border: 0; |
| 23 |
clip: rect(0 0 0 0); |
| 24 |
height: 1px; |
| 25 |
margin: -1px; |
| 26 |
overflow: hidden; |
| 27 |
padding: 0; |
| 28 |
position: absolute; |
| 29 |
width: 1px; |
| 30 |
} |
| 31 |
|
| 32 |
.react-toggle--disabled { |
| 33 |
pointer-events: none; |
| 34 |
-webkit-transition: opacity 0.25s; |
| 35 |
transition: opacity 0.25s; |
| 36 |
} |
| 37 |
|
| 38 |
.react-toggle-track { |
| 39 |
width: 36px; |
| 40 |
height: 18px; |
| 41 |
padding: 0; |
| 42 |
border-radius: 30px; |
| 43 |
background-color: #E0E0E0; |
| 44 |
-webkit-transition: all 0.2s ease; |
| 45 |
-moz-transition: all 0.2s ease; |
| 46 |
transition: all 0.2s ease; |
| 47 |
} |
| 48 |
|
| 49 |
.react-toggle:hover:not(.react-toggle--disabled) .react-toggle-track { |
| 50 |
background-color: #BBBBBB; |
| 51 |
} |
| 52 |
|
| 53 |
.react-toggle--checked .react-toggle-track { |
| 54 |
background-color: #4AB866; |
| 55 |
} |
| 56 |
|
| 57 |
.react-toggle--checked:hover:not(.react-toggle--disabled) .react-toggle-track { |
| 58 |
background-color: #4AB866; |
| 59 |
} |
| 60 |
|
| 61 |
.react-toggle-track-check { |
| 62 |
position: absolute; |
| 63 |
width: 14px; |
| 64 |
height: 10px; |
| 65 |
top: 0px; |
| 66 |
bottom: 0px; |
| 67 |
margin-top: auto; |
| 68 |
margin-bottom: auto; |
| 69 |
line-height: 0; |
| 70 |
left: 8px; |
| 71 |
opacity: 0; |
| 72 |
-webkit-transition: opacity 0.25s ease; |
| 73 |
-moz-transition: opacity 0.25s ease; |
| 74 |
transition: opacity 0.25s ease; |
| 75 |
} |
| 76 |
|
| 77 |
.react-toggle--checked .react-toggle-track-check { |
| 78 |
opacity: 1; |
| 79 |
-webkit-transition: opacity 0.25s ease; |
| 80 |
-moz-transition: opacity 0.25s ease; |
| 81 |
transition: opacity 0.25s ease; |
| 82 |
} |
| 83 |
|
| 84 |
.react-toggle-track-x { |
| 85 |
position: absolute; |
| 86 |
width: 14px; |
| 87 |
height: 10px; |
| 88 |
top: 0px; |
| 89 |
bottom: 0px; |
| 90 |
margin-top: auto; |
| 91 |
margin-bottom: auto; |
| 92 |
line-height: 0; |
| 93 |
right: 8px; |
| 94 |
opacity: 1; |
| 95 |
-webkit-transition: opacity 0.25s ease; |
| 96 |
-moz-transition: opacity 0.25s ease; |
| 97 |
transition: opacity 0.25s ease; |
| 98 |
} |
| 99 |
|
| 100 |
.react-toggle--checked .react-toggle-track-x { |
| 101 |
opacity: 0; |
| 102 |
-webkit-transition: opacity 0.25s ease; |
| 103 |
-moz-transition: opacity 0.25s ease; |
| 104 |
transition: opacity 0.25s ease; |
| 105 |
} |
| 106 |
|
| 107 |
.react-toggle-thumb { |
| 108 |
position: absolute; |
| 109 |
top: 1px; |
| 110 |
left: 1px; |
| 111 |
width: 16px; |
| 112 |
height: 16px; |
| 113 |
border-radius: 50%; |
| 114 |
background-color: #FAFAFA; |
| 115 |
-webkit-transition: all 0.2s ease; |
| 116 |
-moz-transition: all 0.2s ease; |
| 117 |
transition: all 0.2s ease; |
| 118 |
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); |
| 119 |
} |
| 120 |
|
| 121 |
.react-toggle--checked .react-toggle-thumb { |
| 122 |
-webkit-transition: all 0.2s ease; |
| 123 |
-moz-transition: all 0.2s ease; |
| 124 |
transition: all 0.2s ease; |
| 125 |
transform: translateX(18px); |
| 126 |
} |
| 127 |
} |
| 128 |
|