Switch.module.css
1.05 KB
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
.switch {
position: relative;
display: inline-flex;
width: 38px;
height: 22px;
align-items: center;
border: 0;
border-radius: 999px;
background: var(--gl-color-text-secondary);
cursor: pointer;
transition:
background-color 120ms ease,
opacity 120ms ease;
}
.switch:focus-visible {
outline: 2px solid color-mix(in srgb, var(--gl-color-primary) 24%, transparent);
outline-offset: 2px;
}
.switch:disabled {
cursor: not-allowed;
opacity: 0.55;
}
.checked {
background: var(--gl-color-primary);
}
.handle {
position: absolute;
left: 3px;
width: 16px;
height: 16px;
border-radius: 999px;
background: #fff;
box-shadow: 0 1px 2px rgb(16 24 40 / 16%);
transition: transform 120ms ease;
}
.checked .handle {
transform: translateX(16px);
}
.loading .handle::after {
position: absolute;
inset: 4px;
border: 1px solid var(--gl-color-primary);
border-top-color: transparent;
border-radius: 999px;
animation: spin 720ms linear infinite;
content: '';
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}