forked from scientific-python/scientific-python-hugo-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_dropdown.scss
More file actions
248 lines (206 loc) · 5.03 KB
/
_dropdown.scss
File metadata and controls
248 lines (206 loc) · 5.03 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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
details.sd-dropdown {
position: relative;
.sd-summary-title {
font-weight: 700;
// don't overlap the chevron
padding-right: 3em !important;
user-select: none;
display: inline-flex;
justify-content: space-between;
align-items: center;
width: 100%;
.sd-summary-text {
flex-grow: 1;
line-height: 1.5;
padding-right: 0.5rem;
}
.sd-summary-state-marker {
position: absolute;
right: 1em;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
display: inline-flex;
align-items: center;
justify-content: center;
width: 0.75em;
}
// The hover effect should only change opacity, not transform.
// We are transforming the chevron elements instead, see below.
&:hover .sd-summary-state-marker svg {
opacity: 1;
}
}
&:hover {
cursor: pointer;
}
.sd-summary-content {
cursor: default;
}
summary {
// hide the default triangle marker
list-style: none;
padding: 1em;
// Ellipsis added when no title
.sd-octicon.no-title {
vertical-align: middle;
}
}
&[open] summary .sd-octicon.no-title {
visibility: hidden;
}
// chrome doesn't yet support list-style
summary::-webkit-details-marker {
display: none;
}
summary:focus {
outline: none;
}
.sd-summary-icon {
margin-right: 0.5em;
}
.sd-summary-icon svg {
opacity: 0.8;
}
summary:hover .sd-summary-up svg,
summary:hover .sd-summary-down svg {
opacity: 1;
}
.sd-summary-up svg,
.sd-summary-down svg {
display: block;
opacity: 0.6;
}
.sd-summary-up,
.sd-summary-down {
pointer-events: none;
position: absolute;
right: 1em;
top: 1em;
}
&[open] > .sd-summary-title .sd-summary-down {
visibility: hidden;
}
&:not([open]) > .sd-summary-title .sd-summary-up {
visibility: hidden;
}
// Chevron transitions
.sd-summary-chevron-right i,
.sd-summary-chevron-down i {
display: inline-block;
transform-origin: center;
opacity: 0.6;
}
// The chevron rotation animations are applied to
// the icon inside the dropdown title div
&[open] > .sd-summary-title .sd-summary-chevron-right i {
transform: rotate(90deg);
animation: rotate-to-90 0.25s ease-in-out;
}
&[open] > .sd-summary-title .sd-summary-chevron-down i {
transform: rotate(-180deg);
animation: rotate-to-negative-180 0.25s ease-in-out;
}
&:not([open]) > .sd-summary-title .sd-summary-chevron-right i {
transform: rotate(0deg);
animation: rotate-to-0-from-90 0.25s ease-in-out;
}
&:not([open]) > .sd-summary-title .sd-summary-chevron-down i {
transform: rotate(0deg);
animation: rotate-to-0-from-negative-180 0.25s ease-in-out;
}
> .sd-summary-title:hover .sd-summary-chevron-right i,
> .sd-summary-title:hover .sd-summary-chevron-down i {
opacity: 1;
}
// Combined transforms for each state with hover. These cover
// the cases where the chevron is rotated, say, when the dropdown
// is open or if the chevron starts rotated (e.g. in the down-up
// state).
&:not([open]) > .sd-summary-title:hover .sd-summary-chevron-right i {
transform: scale(1.1);
}
&:not([open]) > .sd-summary-title:hover .sd-summary-chevron-down i {
transform: scale(1.1);
}
&[open] > .sd-summary-title:hover .sd-summary-chevron-right i {
transform: rotate(90deg) scale(1.1);
}
&[open] > .sd-summary-title:hover .sd-summary-chevron-down i {
transform: rotate(-180deg) scale(1.1);
}
// Hide the card body border when not open
&:not([open]).sd-card {
border: none;
}
&:not([open]) > .sd-card-header {
border: 1px solid var(--sd-color-card-border);
border-radius: 0.25rem;
}
// Transition animation
&.sd-fade-in[open] summary ~ * {
animation: sd-fade-in 0.5s ease-in-out;
}
&.sd-fade-in-slide-down[open] summary ~ * {
animation:
sd-fade-in 0.5s ease-in-out,
sd-slide-down 0.5s ease-in-out;
}
}
.sd-col > .sd-dropdown {
width: 100%;
}
.sd-summary-content > .sd-tab-set:first-child {
margin-top: 0;
}
@keyframes sd-fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes sd-slide-down {
0% {
transform: translate(0, -10px);
}
100% {
transform: translate(0, 0);
}
}
@keyframes rotate-to-90 {
from {
transform: rotate(0deg) scale(1.1);
}
to {
transform: rotate(90deg) scale(1.1);
}
}
@keyframes rotate-to-0-from-90 {
from {
transform: rotate(90deg) scale(1.1);
}
to {
transform: rotate(0deg) scale(1.1);
}
}
// TODO: These keyframes are disabled for now to maintain
// parity with Sphinx Design upstream, which does not implement
// the down-up chevron animation.
// @keyframes rotate-to-negative-180 {
// from {
// transform: rotate(0deg) scale(1.1);
// }
// to {
// transform: rotate(-180deg) scale(1.1);
// }
// }
// @keyframes rotate-to-0-from-negative-180 {
// from {
// transform: rotate(-180deg) scale(1.1);
// }
// to {
// transform: rotate(0deg) scale(1.1);
// }
// }