-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy path_dropdown.scss
More file actions
145 lines (120 loc) · 3.34 KB
/
_dropdown.scss
File metadata and controls
145 lines (120 loc) · 3.34 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
details.sd-dropdown {
position: relative;
font-size: var(--sd-fontsize-dropdown);
&:hover {
cursor: pointer;
}
.sd-summary-content {
cursor: default;
}
summary.sd-summary-title {
padding: 0.5em 0.6em 0.5em 1em;
font-size: var(--sd-fontsize-dropdown-title);
font-weight: var(--sd-fontweight-dropdown-title);
// make the text un-selectable
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
// hide the default triangle marker
list-style: none;
// chrome doesn't yet support list-style
&::-webkit-details-marker {
display: none;
}
// The title is split into three parts:
// 1. The icon (optional), which should be on the left
// 2. The text, which should be in the middle, and take all available space
// 3. The state marker, which should be on the right
display: inline-flex;
justify-content: space-between;
outline-offset: 0.25rem;
.sd-summary-icon {
margin-right: 0.6em;
// align the icon vertically within its container
display: inline-flex;
align-items: center;
}
.sd-summary-icon svg {
opacity: 0.8;
}
.sd-summary-text {
flex-grow: 1;
line-height: 1.5;
// note, we add right padding to the text, rather than a left margin to the state marker,
// because when you rotate the state marker, left is no longer left
padding-right: 0.5rem;
}
.sd-summary-state-marker {
pointer-events: none;
// align the icon vertically within its container
display: inline-flex;
align-self: center;
}
// make the state marker a bit more prominent when hovered
.sd-summary-state-marker svg {
opacity: 0.6;
}
&:hover .sd-summary-state-marker svg {
opacity: 1;
transform: scale(1.1);
}
}
// Hide the octicon added as a placeholder for when no title is provided,
// but only when the summary is open
&[open] summary .sd-octicon.no-title {
visibility: hidden;
}
// setup how state marker changes on open/close of the dropdown
.sd-summary-chevron-right {
transition: 0.25s;
}
&[open] > .sd-summary-title .sd-summary-chevron-right {
transform: rotate(90deg);
}
&[open] > .sd-summary-title .sd-summary-chevron-down {
transform: rotate(180deg);
}
// 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 ~ * {
-moz-animation: sd-fade-in 0.5s ease-in-out;
-webkit-animation: sd-fade-in 0.5s ease-in-out;
animation: sd-fade-in 0.5s ease-in-out;
}
&.sd-fade-in-slide-down[open] summary ~ * {
-moz-animation: sd-fade-in 0.5s ease-in-out, sd-slide-down 0.5s ease-in-out;
-webkit-animation: sd-fade-in 0.5s ease-in-out,
sd-slide-down 0.5s ease-in-out;
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);
}
}