| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 1 | @mixin marginTransition { | 
|  | 2 | -webkit-transition: margin 0.4s, background 0.4s; | 
|  | 3 | -moz-transition: margin 0.4s, background 0.4s; | 
|  | 4 | -o-transition: margin 0.4s, background 0.4s; | 
|  | 5 | transition: margin 0.4s, background 0.4s; | 
|  | 6 | } | 
|  | 7 |  | 
|  | 8 | @mixin borderRadius { | 
|  | 9 | -webkit-border-radius: 60px; | 
|  | 10 | -moz-border-radius: 60px; | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 11 | border-radius: 60px; | 
|  | 12 | } | 
|  | 13 |  | 
|  | 14 | .toggle-switch { | 
|  | 15 | position: absolute; | 
| Michael Davis | 9e00ce9 | 2017-03-09 18:31:02 -0600 | [diff] [blame] | 16 | left: 20px; | 
|  | 17 | height: 1px; | 
|  | 18 | width: 1px; | 
|  | 19 | opacity: 0; | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 20 | } | 
| Michael Davis | c562618 | 2017-03-10 15:48:05 -0600 | [diff] [blame] | 21 |  | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 22 | .toggle-switch + label { | 
|  | 23 | display: block; | 
|  | 24 | position: relative; | 
|  | 25 | cursor: pointer; | 
|  | 26 | outline: none; | 
|  | 27 | -webkit-user-select: none; | 
|  | 28 | -moz-user-select: none; | 
|  | 29 | -ms-user-select: none; | 
|  | 30 | user-select: none; | 
|  | 31 | } | 
|  | 32 |  | 
| Michael Davis | c562618 | 2017-03-10 15:48:05 -0600 | [diff] [blame] | 33 | .toggle label { | 
|  | 34 | text-indent: -9999px; | 
|  | 35 | transform: translateY(-50%); // keeps switch centered | 
|  | 36 | } | 
|  | 37 |  | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 38 | input.toggle-switch__round-flat + label { | 
|  | 39 | padding: 2px; | 
|  | 40 | width: 50px; | 
|  | 41 | height: 30px; | 
| Michael Davis | 9a97e59 | 2017-07-27 15:41:35 -0500 | [diff] [blame^] | 42 | background-color: darken($medgrey, 8%); | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 43 | @include borderRadius; | 
|  | 44 | @include marginTransition; | 
|  | 45 | } | 
| Michael Davis | 9e00ce9 | 2017-03-09 18:31:02 -0600 | [diff] [blame] | 46 |  | 
|  | 47 | input.toggle-switch__round-flat:focus + label { | 
|  | 48 | box-shadow: 0 0 4px 4px $darkbg__accent; | 
|  | 49 | } | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 50 | input.toggle-switch__round-flat + label:before, input.toggle-switch__round-flat + label:after { | 
|  | 51 | display: block; | 
|  | 52 | position: absolute; | 
|  | 53 | content: ""; | 
|  | 54 | } | 
|  | 55 | input.toggle-switch__round-flat + label:before { | 
|  | 56 | top: 2px; | 
|  | 57 | left: 2px; | 
|  | 58 | bottom: 2px; | 
|  | 59 | right: 2px; | 
|  | 60 | background-color: $white; | 
|  | 61 | @include borderRadius; | 
|  | 62 | @include marginTransition; | 
|  | 63 | } | 
|  | 64 | input.toggle-switch__round-flat + label:after { | 
|  | 65 | top: 4px; | 
|  | 66 | left: 4px; | 
|  | 67 | bottom: 4px; | 
|  | 68 | width: 20px; | 
| Michael Davis | 9a97e59 | 2017-07-27 15:41:35 -0500 | [diff] [blame^] | 69 | background-color: darken($medgrey, 8%); | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 70 | -webkit-border-radius: 52px; | 
|  | 71 | -moz-border-radius: 52px; | 
| Michael Davis | 5a752b2 | 2017-03-09 09:41:08 -0600 | [diff] [blame] | 72 | border-radius: 52px; | 
|  | 73 | @include marginTransition; | 
|  | 74 | } | 
|  | 75 | input.toggle-switch__round-flat:checked + label { | 
|  | 76 | background-color: $primebtn__bg; | 
|  | 77 | } | 
|  | 78 | input.toggle-switch__round-flat:checked + label:before { | 
|  | 79 | background-color: $lightbg__accent; | 
|  | 80 | } | 
|  | 81 | input.toggle-switch__round-flat:checked + label:after { | 
|  | 82 | margin-left: 20px; | 
|  | 83 | background-color: $primebtn__bg; | 
|  | 84 | } |