-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathaccordion.scss
81 lines (65 loc) · 1.65 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
72
73
74
75
76
77
78
79
80
81
/**
* @license EUPL-1.2+
* Copyright Gemeente Amsterdam
*/
@use "../../common/text-rendering" as *;
.ams-accordion {
display: flex;
flex-direction: column;
gap: var(--ams-accordion-gap);
@include text-rendering;
}
.ams-accordion__header {
display: flex;
margin-block: 0;
margin-inline: 0;
}
@mixin reset-button {
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]
// [1] Remove the margin in older Safari.
}
.ams-accordion__button {
background-color: transparent;
color: var(--ams-accordion-button-color);
cursor: pointer;
display: flex;
font-family: var(--ams-accordion-button-font-family);
font-size: var(--ams-accordion-button-font-size);
font-weight: var(--ams-accordion-button-font-weight);
gap: var(--ams-accordion-button-gap);
inline-size: 100%;
line-height: var(--ams-accordion-button-line-height);
padding-block: var(--ams-accordion-button-padding-block);
padding-inline: var(--ams-accordion-button-padding-inline);
text-align: start;
@include reset-button;
&:focus {
outline-offset: var(--ams-accordion-button-focus-outline-offset);
}
&:hover {
color: var(--ams-accordion-button-hover-color);
}
}
.ams-accordion__icon svg {
rotate: 0deg;
transition: none;
[aria-expanded="true"] & {
rotate: -180deg;
}
@media not (prefers-reduced-motion) {
transition: rotate 0.3s ease;
}
}
.ams-accordion__button[aria-expanded="true"] svg {
rotate: -180deg;
}
.ams-accordion__panel {
display: none;
padding-block: var(--ams-accordion-panel-padding-block);
padding-inline: var(--ams-accordion-panel-padding-inline);
}
.ams-accordion__panel--expanded {
display: block;
}