-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaccordion.scss
87 lines (83 loc) · 1.97 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
82
83
84
85
86
87
@use '../hue/utils' as hue;
@layer hueeye {
.he-accordion {
list-style: none;
margin-block: 0;
padding-left: 0;
display: grid;
border-radius: 4px;
li {
display: flex;
flex-direction: column;
background-color: var(--surface);
&:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
&:last-child {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
}
}
.he-summary {
display: flex;
gap: var(--size-1);
padding: var(--size-1) var(--size-2);
text-align: start;
width: 100%;
min-height: 48px;
border: none;
background-color: transparent;
overflow: hidden;
&:focus-visible {
// We use border, else outline is hidden by next button
outline: none;
border: solid 1px var(--divider);
}
&:hover {
@include hue.hover(transparent, var(--text));
}
&:active {
@include hue.focus(transparent, var(--text));
}
.he-summary-prefix {
transition: transform 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}
.he-summary-title {
transform-origin: left;
transition: transform 0.2s var(--ease-out);
}
}
.he-details-panel {
transform-origin: top;
height: 0;
display: none;
}
li.open {
margin-block: 16px;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
.he-summary {
.he-summary-prefix {
opacity: 0;
transform: scale(0.2);
pointer-events: none;
}
.he-summary-title {
transform: scale(1.4);
}
.he-summary-prefix + .he-summary-title {
transform: translateX(calc(-24px - var(--size-1))) scale(1.4);
}
}
.he-details-panel {
display: block;
height: auto;
}
}
}
}