summaryrefslogtreecommitdiff
path: root/assets/_theme-switcher.scss
blob: bcc59d294ef2f529e1bd5f0ce909348692941aa4 (about) (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
/**
 * Docs: Theme switcher
 */

.switcher {
  position: fixed;
  right: calc(var(--spacing) / 2 + var(--scrollbar-width, 0px));
  bottom: var(--spacing);
  width: auto;
  margin-bottom: 0;
  padding: 0.75rem;
  border-radius: 2rem;
  box-shadow: var(--card-box-shadow);
  line-height: 1;
  text-align: right;

  &::after {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 0.15rem solid currentColor;
    border-radius: 50%;
    background: linear-gradient(
      to right,
      currentColor 0%,
      currentColor 50%,
      transparent 50%
    );
    content: "";
    vertical-align: bottom;
    transition: transform var(--transition);
  }

  i {
    display: inline-block;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    font-style: normal;
    font-size: 0.875rem;
    white-space: nowrap;
  }

  &:hover,
  &:focus {
    max-width: 100%;
    transition: background-color var(--transition),
      border-color var(--transition), color var(--transition),
      box-shadow var(--transition);
  }

  &:hover {
    &::after {
      transform: rotate(180deg);
    }

    i {
      max-width: 100%;
      padding: 0 calc(var(--spacing) / 2) 0 calc(var(--spacing) / 4);
      transition: max-width var(--transition), padding var(--transition);
    }
  }

  &:focus {
    box-shadow: var(--card-box-shadow), 0 0 0 0.2rem var(--secondary-focus);
  }

  @media (min-width: map-get($breakpoints, "sm")) {
    right: calc(var(--spacing) + var(--scrollbar-width, 0px));
  }
}