blob: 6ea50540e8c44923c803edeb8cb9cf7c23907c09 [file] [log] [blame]
Michael Davis5a752b22017-03-09 09:41:08 -06001@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;
11 -ms-border-radius: 60px;
12 border-radius: 60px;
13}
14
15.toggle-switch {
16 position: absolute;
Michael Davis9e00ce92017-03-09 18:31:02 -060017 left: 20px;
18 height: 1px;
19 width: 1px;
20 opacity: 0;
Michael Davis5a752b22017-03-09 09:41:08 -060021}
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
33input.toggle-switch__round-flat + label {
34 padding: 2px;
35 width: 50px;
36 height: 30px;
37 background-color: $lightgrey;
38 @include borderRadius;
39 @include marginTransition;
40}
Michael Davis9e00ce92017-03-09 18:31:02 -060041
42input.toggle-switch__round-flat:focus + label {
43 box-shadow: 0 0 4px 4px $darkbg__accent;
44}
Michael Davis5a752b22017-03-09 09:41:08 -060045input.toggle-switch__round-flat + label:before, input.toggle-switch__round-flat + label:after {
46 display: block;
47 position: absolute;
48 content: "";
49}
50input.toggle-switch__round-flat + label:before {
51 top: 2px;
52 left: 2px;
53 bottom: 2px;
54 right: 2px;
55 background-color: $white;
56 @include borderRadius;
57 @include marginTransition;
58}
59input.toggle-switch__round-flat + label:after {
60 top: 4px;
61 left: 4px;
62 bottom: 4px;
63 width: 20px;
64 background-color: $lightgrey;
65 -webkit-border-radius: 52px;
66 -moz-border-radius: 52px;
67 -ms-border-radius: 52px;
68 border-radius: 52px;
69 @include marginTransition;
70}
71input.toggle-switch__round-flat:checked + label {
72 background-color: $primebtn__bg;
73}
74input.toggle-switch__round-flat:checked + label:before {
75 background-color: $lightbg__accent;
76}
77input.toggle-switch__round-flat:checked + label:after {
78 margin-left: 20px;
79 background-color: $primebtn__bg;
80}