summaryrefslogtreecommitdiffstats
path: root/app/common/styles/elements/toggle-switch.scss
blob: 814da91afb08e29e7fa55f88e4d227679f03fc91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@mixin marginTransition {
  transition: margin $duration--moderate-01, background $duration--moderate-01;
}

@mixin borderRadius {
  -webkit-border-radius: 60px;
  -moz-border-radius: 60px;
  border-radius: 60px;
}

.toggle-container {
  display: flex;
}

.toggle-switch {
  position: absolute;
  top: 0;
  opacity: 0;
}

.toggle-switch + label {
  display: block;
  position: relative;
  cursor: pointer;
  outline: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.toggle label {
  text-indent: -9999px;
  margin-right: 0.3rem;
}

input.toggle-switch__round-flat:focus + label {
  outline: 1px solid $primary-accent;
  outline-offset: 3px;
}

input.toggle-switch__round-flat + label {
  padding: 2px;
  width: 43px;
  height: 22px;
  background-color: $border-color-02;
  @include borderRadius;
  @include marginTransition;
}

input.toggle-switch__round-flat + label:before,
input.toggle-switch__round-flat + label:after {
  display: block;
  position: absolute;
  content: "";
}
input.toggle-switch__round-flat + label:before {
  top: 2px;
  left: 2px;
  bottom: 2px;
  right: 2px;
  background-color: $primary-light;
  @include borderRadius;
  @include marginTransition;
}
input.toggle-switch__round-flat + label:after {
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: 15px;
  background-color: $border-color-02;
  -webkit-border-radius: 52px;
  -moz-border-radius: 52px;
  border-radius: 52px;
  @include marginTransition;
}
input.toggle-switch__round-flat:checked + label {
  background-color: $primary-accent;
}
input.toggle-switch__round-flat:checked + label:before {
  background-color: $primary-accent;
}
input.toggle-switch__round-flat:checked + label:after {
  margin-left: 20px;
  background-color: $primary-light;
}
OpenPOWER on IntegriCloud