Skip to content

Commit cc63c9c

Browse files
committed
Refine command palette
1 parent c5c47ca commit cc63c9c

File tree

4 files changed

+72
-27
lines changed

4 files changed

+72
-27
lines changed

src/main/js/components/command-palette/index.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -94,18 +94,23 @@ function init() {
9494
}
9595

9696
searchResultsContainer.style.height = searchResults.offsetHeight + "px";
97+
debouncedSpinner.cancel();
9798
commandPaletteSearchBarContainer.classList.remove(
9899
"jenkins-search--loading",
99100
);
100101
});
101102
}
102103

104+
const debouncedSpinner = debounce(() => {
105+
commandPaletteSearchBarContainer.classList.add("jenkins-search--loading");
106+
}, 150);
107+
103108
const debouncedLoad = debounce(() => {
104109
renderResults();
105110
}, 150);
106111

107112
commandPaletteInput.addEventListener("input", () => {
108-
commandPaletteSearchBarContainer.classList.add("jenkins-search--loading");
113+
debouncedSpinner();
109114
debouncedLoad();
110115
});
111116

@@ -119,7 +124,16 @@ function init() {
119124
}
120125

121126
function hideCommandPalette() {
122-
commandPalette.close();
127+
commandPalette.setAttribute("closing", "");
128+
129+
commandPalette.addEventListener(
130+
"animationend",
131+
() => {
132+
commandPalette.removeAttribute("closing");
133+
commandPalette.close();
134+
},
135+
{ once: true },
136+
);
123137
}
124138

125139
function itemMouseEnter(item) {

src/main/scss/components/_command-palette.scss

+49-24
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
@use "../abstracts/mixins";
22

3-
.jenkins-command-palette__dialog {
4-
&::backdrop {
5-
background: var(--command-palette-backdrop-background);
6-
backdrop-filter: contrast(0.7) brightness(0.9) saturate(1.25) blur(3px);
7-
animation: jenkins-modal-backdrop-animate-in 0.3s;
8-
}
9-
}
10-
113
.jenkins-command-palette__dialog {
124
background: none;
135
border: none;
@@ -17,6 +9,41 @@
179
max-width: 100vw !important;
1810
margin: 0 !important;
1911
padding: 0 !important;
12+
user-select: none;
13+
14+
&::backdrop {
15+
background: var(--command-palette-backdrop-background);
16+
backdrop-filter: contrast(0.7) brightness(0.9) saturate(1.25) blur(3px);
17+
animation: jenkins-dialog-backdrop-animate-in 0.1s linear;
18+
}
19+
20+
&[open] {
21+
animation: command-palette-animate-in 0.1s cubic-bezier(0, 0.68, 0.5, 1.5);
22+
}
23+
24+
&[closing] {
25+
animation: command-palette-animate-out 0.1s linear;
26+
27+
&::backdrop {
28+
animation: jenkins-dialog-backdrop-animate-out 0.1s linear;
29+
}
30+
}
31+
}
32+
33+
@keyframes command-palette-animate-in {
34+
from {
35+
translate: 0 4px;
36+
scale: 98.5%;
37+
opacity: 0;
38+
transform: rotateX(30deg);
39+
}
40+
}
41+
42+
@keyframes command-palette-animate-out {
43+
to {
44+
scale: 98.5%;
45+
opacity: 0;
46+
}
2047
}
2148

2249
.jenkins-command-palette__wrapper {
@@ -40,9 +67,7 @@
4067
--search-bar-height: 3rem !important;
4168

4269
background: transparent;
43-
box-shadow:
44-
0 0 0 20px transparent,
45-
var(--command-palette-inset-shadow);
70+
box-shadow: var(--command-palette-inset-shadow);
4671
margin-bottom: 1.5rem;
4772
border-radius: 1rem;
4873
transition: var(--standard-transition);
@@ -71,7 +96,8 @@
7196
border-radius: 1rem;
7297
backdrop-filter: var(--command-palette-results-backdrop-filter);
7398
box-shadow: var(--command-palette-inset-shadow);
74-
height: 0;
99+
// If set to 0, Safari won't always show the backdrop-filter
100+
height: 1px;
75101
transition: height var(--standard-transition);
76102
overflow: hidden;
77103
will-change: height;
@@ -83,8 +109,8 @@
83109
padding: 0.5rem;
84110

85111
&__heading {
86-
font-weight: 600;
87-
font-size: 0.85rem;
112+
font-weight: 500;
113+
font-size: 0.875rem;
88114
margin: 0;
89115
padding: 0.75rem 0.75rem 0.625rem;
90116
color: var(--text-color-secondary);
@@ -113,8 +139,7 @@
113139
justify-content: flex-start;
114140
background: transparent;
115141
padding: 0.75rem;
116-
border-radius: 0.66rem;
117-
font-weight: 600;
142+
border-radius: 0.5rem;
118143
cursor: pointer;
119144
color: var(--text-color) !important;
120145
transition: var(--standard-transition);
@@ -132,17 +157,17 @@
132157
display: flex;
133158
align-items: center;
134159
justify-content: center;
135-
width: 1.4rem;
136-
height: 1.4rem;
137-
margin-right: 12.5px;
160+
width: 1.375rem;
161+
height: 1.375rem;
162+
margin-right: 0.75rem;
138163
overflow: hidden;
139164
pointer-events: none;
140165
color: var(--text-color);
141166

142167
svg,
143168
img {
144-
width: 1.2rem;
145-
height: 1.2rem;
169+
width: 1.125rem;
170+
height: 1.125rem;
146171
}
147172
}
148173

@@ -163,10 +188,10 @@
163188
}
164189

165190
&__info {
166-
font-weight: 600;
167-
font-size: 0.85rem;
191+
font-size: 0.875rem;
168192
margin: 0;
169-
padding: 12.5px 12.5px 10px;
193+
padding: 0 14px;
194+
line-height: 46px;
170195
color: var(--text-color);
171196

172197
span {

src/main/scss/components/_dialogs.scss

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ $jenkins-dialog-padding: 1.3rem;
8787
}
8888
}
8989

90+
@keyframes jenkins-dialog-backdrop-animate-out {
91+
to {
92+
opacity: 0;
93+
}
94+
}
95+
9096
@keyframes jenkins-dialog-animate-in {
9197
from {
9298
scale: 85%;

src/main/scss/form/_search-bar.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
place-self: center center;
134134
opacity: 0;
135135
scale: 0;
136-
filter: blur(5px);
136+
filter: blur(2.5px);
137137
}
138138

139139
&::after {

0 commit comments

Comments
 (0)