summaryrefslogtreecommitdiff
path: root/_sass/misc/theme-toggle.scss
blob: 4b79078a6b02d3d41774bea948f2cefdcca50ae2 (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
.theme-toggle {
  position: relative;
  width: $base-font-size * 7.65;
  margin-top: 10px;
  margin-right: 60px;
  margin-left: auto;
  transition: .3s cubic-bezier(.4,.03,0,1);

  label, .toggle {
    border-radius: 100px;
  }

  label {
    display: block;
    background-color: rgba(120,120,120,.15);
    cursor: pointer;
  }

  .toggle {
    position: absolute;
    width: 50%;
    height: 100%;
    background-color: #fff;
    box-shadow: 0 2px 15px rgba(0,0,0,.15);
    transition: transform .2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }

  .names {
    font-size: 1em;
    font-weight: bolder;
    width: 76%;
    margin-left: 12%;
    position: relative;
    display: flex;
    justify-content: space-between;
    user-select: none;
  }

  .names p {
    margin-bottom: 0;
    line-height: 24px;
    opacity: .5;
  }

  label .light {
    color: #868686;
    margin-left: -0.2em;
  }

  label .dark {
    color: #b9b9b9;
  }

  [type="checkbox"] {
    display: none;
  }

  /* Toggle */
  [type="checkbox"]:checked ~ label .toggle {
    transform: translateX(100%);
    background-color: #34323D;
  }

  [type="checkbox"]:checked ~ label .dark {
    color: #ddd;
  }

  [type="checkbox"]:checked ~ label .light {
    color: #ccc;
  }

  @include media-query(1024px) {
    margin-right: 35px;
  }

  @include media-query($on-palm) {
    width: $base-font-size * 6.65;
    margin-right: 20px;

    .names {
      font-size: .85em;
    }
  }
}