-
Notifications
You must be signed in to change notification settings - Fork 369
/
_accordion.scss
71 lines (60 loc) · 1.27 KB
/
_accordion.scss
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
/**
* Accordion (<details>)
* Inspiration: https://codepen.io/koca/pen/RyeLLV
*/
details {
display: block;
margin-bottom: var(--spacing-typography);
padding-bottom: calc(var(--spacing-typography) / 2);
border-bottom: 1px solid var(--muted-border);
summary {
line-height: 1rem;
list-style-type: none;
cursor: pointer;
// Reset marker
&::-webkit-details-marker {
display: none;
}
&::marker {
display: none;
}
&::-moz-list-bullet {
list-style-type: none;
}
// Marker
&::after {
display: inline-block;
width: 1rem;
height: 1rem;
float: right;
transform: rotate(-90deg);
background-image: var(--icon-chevron);
background-position: center;
background-repeat: no-repeat;
background-size: 1rem auto;
content: '';
@if $enable-transitions {
transition: transform var(--transition);
}
}
&:focus {
outline: none;
}
~ * {
margin-top: calc(var(--spacing-typography) / 2);
~ * {
margin-top: 0;
}
}
}
// Open
&[open] {
summary {
margin-bottom: calc(var(--spacing-typography) / 4);
color: var(--muted-text);
&::after {
transform: rotate(0);
}
}
}
}