Skip to content

Commit f09d663

Browse files
feat(search-view): improve UI (#469)
1 parent c3a65c8 commit f09d663

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

public/components/views/search/search.css

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
width: 100%;
2020
max-width: 600px;
2121
min-height: 150px;
22-
margin: 135px auto;
22+
margin: 85px auto;
2323
}
2424

2525
#search--view form {
@@ -58,6 +58,7 @@
5858
margin-top: 10px;
5959
border-radius: 4px;
6060
width: 100%;
61+
max-height: 330px;
6162
}
6263

6364
.result-container::-webkit-scrollbar {
@@ -109,7 +110,7 @@
109110
}
110111

111112
.result select {
112-
max-width: 70px;
113+
width: 70px;
113114
margin-right: 5px;
114115
margin-top: 5px;
115116
background: #edf1fb;
@@ -120,9 +121,9 @@
120121
flex-direction: row;
121122
align-items: center;
122123
justify-content: center;
123-
margin-top: 20px;
124124
width: 100%;
125125
margin: auto;
126+
margin-bottom: 10px;
126127
padding: 10px;
127128
border-radius: 4px;
128129
background: linear-gradient(135deg, rgba(242, 245, 246, 1) 0%, rgba(227, 234, 237, 1) 37%, rgba(234, 238, 239, 1) 100%);
@@ -191,7 +192,7 @@ input:-webkit-autofill {
191192

192193
.package-result {
193194
display: flex;
194-
flex-direction: row;
195+
flex-direction: column;
195196
align-items: flex-start;
196197
padding-left: 5px;
197198
width: 100%;
@@ -216,9 +217,23 @@ input:-webkit-autofill {
216217
margin-top: 5px;
217218
margin-bottom: 8px;
218219
line-height: 20px;
220+
word-break: break-word;
221+
overflow-wrap: break-word;
222+
}
223+
224+
.package-cache-result {
225+
display: flex;
226+
flex-direction: row;
227+
align-items: center;
228+
justify-content: space-between;
229+
width: 100%;
230+
padding: 5px 0;
231+
margin-top: 10px;
232+
background: #54688419;
233+
padding: 5px 10px;
219234
}
220235

221-
.package-result button.remove {
236+
.package-cache-result button.remove {
222237
border: none;
223238
position: relative;
224239
cursor: pointer;
@@ -230,21 +245,22 @@ input:-webkit-autofill {
230245
text-shadow: 1px 1px 10px #000;
231246
font-weight: bold;
232247
width: 20px;
248+
height: 20px;
233249
}
234250

235251
.cache-packages, .recent-packages {
236252
display: flex;
237253
flex-direction: column;
238254
align-items: center;
239-
margin-top: 20px;
240-
margin-bottom: 20px;
255+
margin: 10px 0;
241256
width: 100%;
242257
color: var(--primary);
243258
font-weight: bold;
244259
font-size: 17px;
245260
border: 1px solid #54688424;
246261
padding: 10px;
247262
border-radius: 4px;
263+
min-height: 75px;
248264
max-height: calc(100vh - 380px);
249265
overflow: auto;
250266
}
@@ -254,13 +270,7 @@ input:-webkit-autofill {
254270
color: #546884;
255271
}
256272

257-
.cache-packages .package-result, .recent-packages .package-result {
258-
margin-top: 10px;
259-
background: #54688419;
260-
padding: 5px 10px;
261-
}
262-
263-
.cache-packages .package-result:has(span:hover), .recent-packages .package-result:has(span:hover) {
273+
.cache-packages .package-cache-result:has(span:hover), .recent-packages .package-cache-result:has(span:hover) {
264274
color: var(--secondary-darker);
265275
background: #5468842a;
266276
cursor: pointer;

public/components/views/search/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export class SearchView {
188188
#cachePackageElement(pkg) {
189189
const { name, version, local } = parseNpmSpec(pkg);
190190
const pkgElement = document.createElement("div");
191-
pkgElement.classList.add("package-result");
191+
pkgElement.classList.add("package-cache-result");
192192
const pkgSpanElement = document.createElement("span");
193193
pkgSpanElement.innerHTML = `${name}@${version}${local ? " <b>local</b>" : ""}`;
194194
pkgSpanElement.addEventListener("click", () => {

0 commit comments

Comments
 (0)