Skip to content

Commit 6089637

Browse files
committed
tweaks
1 parent f6c6cc5 commit 6089637

File tree

1 file changed

+80
-43
lines changed

1 file changed

+80
-43
lines changed

packages/site-kit/src/lib/search/SearchBox.svelte

Lines changed: 80 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -160,23 +160,29 @@ It appears when the user clicks on the `Search` component or presses the corresp
160160
>
161161
<div class="search-box">
162162
<div class="controls">
163-
<input
164-
use:forcefocus
165-
onkeydown={(e) => {
163+
<div class="input-group">
164+
<input
165+
use:forcefocus
166+
onkeydown={(e) => {
166167
if (e.key === 'Enter' && !e.isComposing) {
167168
const element = modal.querySelector('a[data-has-node]') as HTMLElement | undefined;
168169
element?.click();
169170
}
170171
}}
171-
oninput={(e) => {
172-
$search_query = e.currentTarget.value;
173-
}}
174-
value={$search_query}
175-
{placeholder}
176-
aria-describedby="search-description"
177-
aria-label={placeholder}
178-
spellcheck="false"
179-
/>
172+
oninput={(e) => {
173+
$search_query = e.currentTarget.value;
174+
}}
175+
value={$search_query}
176+
{placeholder}
177+
aria-describedby="search-description"
178+
aria-label={placeholder}
179+
spellcheck="false"
180+
/>
181+
182+
<button aria-label="Clear" onclick={() => ($search_query = '')}>
183+
<Icon name="close" />
184+
</button>
185+
</div>
180186

181187
<button class="raised" aria-label="Close" onclick={close}>
182188
<!-- <Icon name="close" /> -->
@@ -222,14 +228,15 @@ It appears when the user clicks on the `Search` component or presses the corresp
222228
</a>
223229

224230
<button
231+
class="raised icon"
225232
aria-label="Delete"
226233
onclick={(e) => {
227234
$search_recent = $search_recent.filter((href) => href !== search.href);
228235
e.stopPropagation();
229236
e.preventDefault();
230237
}}
231238
>
232-
<Icon name="delete" />
239+
<Icon name="delete" size={16} />
233240
</button>
234241
</li>
235242
{/each}
@@ -309,39 +316,65 @@ It appears when the user clicks on the `Search` component or presses the corresp
309316
gap: 1rem;
310317
}
311318
312-
input {
313-
font: var(--sk-font-ui-large);
319+
.input-group {
320+
position: relative;
314321
flex: 1;
315-
padding: var(--padding) calc(var(--padding) - 0.5rem);
316-
height: 6rem;
317-
border: none;
318-
flex-shrink: 0;
319-
color: var(--sk-text-1);
320-
border-bottom: 1px solid var(--sk-back-6);
321-
322-
&::selection {
323-
background-color: var(--sk-back-translucent);
324-
}
325322
326-
&::placeholder {
327-
color: var(--sk-text-2);
328-
opacity: 0.3;
323+
input {
324+
font: var(--sk-font-ui-large);
325+
width: 100%;
326+
padding: var(--padding) 6rem var(--padding) calc(var(--padding) - 0.5rem);
327+
height: 6rem;
328+
border: none;
329+
flex-shrink: 0;
330+
color: var(--sk-text-1);
331+
border-bottom: 1px solid var(--sk-back-6);
332+
333+
&::selection {
334+
background-color: var(--sk-back-translucent);
335+
}
336+
337+
&::placeholder {
338+
color: var(--sk-text-2);
339+
opacity: 0.3;
340+
}
341+
342+
&:focus-visible {
343+
outline-offset: -2px;
344+
}
329345
}
330346
331-
&:focus-visible {
332-
outline-offset: -2px;
347+
button {
348+
position: absolute;
349+
right: 0;
350+
top: 0;
351+
height: 100%;
352+
aspect-ratio: 1;
353+
color: var(--sk-text-4);
354+
355+
&:hover,
356+
&:focus {
357+
color: var(--sk-text-3);
358+
}
359+
360+
&:focus-visible {
361+
outline-offset: -2px;
362+
}
333363
}
334364
}
335365
336366
button[aria-label='Close'] {
337367
height: 100%;
338368
aspect-ratio: 1;
339369
background: none;
340-
color: var(--sk-text-2);
370+
371+
&:hover,
372+
&:focus {
373+
color: var(--sk-text-3);
374+
}
341375
342376
&:focus-visible {
343-
opacity: 1;
344-
outline-offset: -3px;
377+
outline-offset: -2px;
345378
}
346379
347380
kbd {
@@ -371,14 +404,22 @@ It appears when the user clicks on the `Search` component or presses the corresp
371404
pointer-events: all;
372405
background: var(--background);
373406
407+
ul {
408+
padding: 0 var(--padding);
409+
}
410+
374411
li {
375412
position: relative;
413+
display: flex;
414+
gap: 1rem;
376415
377416
a {
378417
color: var(--sk-text-2);
379418
display: block;
380419
text-decoration: none;
381-
padding: 0.5rem calc(4rem + var(--padding)) 0.5rem var(--padding);
420+
margin: 0 -0.5rem;
421+
padding: 0.5rem;
422+
flex: 1;
382423
383424
&:hover {
384425
background: rgba(0, 0, 0, 0.05);
@@ -390,21 +431,17 @@ It appears when the user clicks on the `Search` component or presses the corresp
390431
}
391432
392433
button[aria-label='Delete'] {
393-
position: absolute;
394-
top: 0;
395-
right: 0;
396-
width: 5rem;
397-
height: 100%;
398-
color: var(--sk-text-2);
399-
opacity: 0.1;
434+
width: 3.2rem;
435+
height: 3.2rem;
436+
color: var(--sk-text-4);
400437
401438
&:hover {
402-
opacity: 1;
403439
outline: none;
440+
color: var(--sk-text-3);
404441
}
405442
406443
&:focus-visible {
407-
opacity: 1;
444+
color: var(--sk-text-3);
408445
outline-offset: -3px;
409446
}
410447
}

0 commit comments

Comments
 (0)