Skip to content

Commit e8d1da8

Browse files
feat: enhance search component with improved styling and functionality
1 parent bc6cf59 commit e8d1da8

1 file changed

Lines changed: 109 additions & 3 deletions

File tree

docs/_sass/custom/custom.scss

Lines changed: 109 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,32 @@ tr:hover {
327327
}
328328

329329
// Search
330+
.search {
331+
position: relative;
332+
margin-bottom: 1rem;
333+
padding: 0 1rem;
334+
}
335+
336+
.search-input-wrap {
337+
display: flex;
338+
align-items: center;
339+
position: relative;
340+
}
341+
330342
.search-input {
331343
font-family: var(--font-body);
332-
border-radius: 0.5rem;
333-
border: 1px solid var(--color-border);
334-
padding: 0.625rem 1rem;
344+
width: 100%;
345+
padding: 0.625rem 1rem 0.625rem 2.5rem;
335346
font-size: 0.9rem;
347+
background-color: var(--color-bg);
348+
border: 1px solid var(--color-border);
349+
border-radius: 0.5rem;
350+
color: var(--color-text);
351+
transition: all 0.15s ease;
352+
353+
&::placeholder {
354+
color: var(--color-text-muted);
355+
}
336356

337357
&:focus {
338358
border-color: var(--color-primary);
@@ -341,6 +361,92 @@ tr:hover {
341361
}
342362
}
343363

364+
.search-label {
365+
position: absolute;
366+
left: 0.75rem;
367+
top: 50%;
368+
transform: translateY(-50%);
369+
color: var(--color-text-muted);
370+
pointer-events: none;
371+
372+
.search-icon {
373+
width: 1rem;
374+
height: 1rem;
375+
}
376+
}
377+
378+
.search-results {
379+
position: absolute;
380+
top: 100%;
381+
left: 0;
382+
right: 0;
383+
margin-top: 0.5rem;
384+
background-color: var(--color-bg);
385+
border: 1px solid var(--color-border);
386+
border-radius: 0.5rem;
387+
box-shadow: var(--shadow-md);
388+
max-height: 20rem;
389+
overflow-y: auto;
390+
z-index: 100;
391+
}
392+
393+
.search-results-list {
394+
list-style: none;
395+
padding: 0.5rem;
396+
margin: 0;
397+
}
398+
399+
.search-results-list-item {
400+
padding: 0.5rem 0.75rem;
401+
border-radius: 0.375rem;
402+
cursor: pointer;
403+
404+
&:hover,
405+
&.active {
406+
background-color: var(--color-bg-tertiary);
407+
}
408+
}
409+
410+
.search-result-title {
411+
font-weight: 600;
412+
color: var(--color-text);
413+
font-size: 0.9rem;
414+
}
415+
416+
.search-result-doc {
417+
font-size: 0.8rem;
418+
color: var(--color-text-secondary);
419+
margin-top: 0.125rem;
420+
421+
.search-result-doc-title {
422+
font-weight: 500;
423+
}
424+
}
425+
426+
.search-result-previews {
427+
font-size: 0.8rem;
428+
color: var(--color-text-muted);
429+
margin-top: 0.25rem;
430+
}
431+
432+
.search-result-preview + .search-result-preview {
433+
margin-top: 0.125rem;
434+
}
435+
436+
.search-result-highlight {
437+
background-color: rgba(124, 58, 237, 0.15);
438+
color: var(--color-primary-dark);
439+
padding: 0.125em 0.25em;
440+
border-radius: 0.25rem;
441+
}
442+
443+
.search-no-result {
444+
padding: 1rem;
445+
text-align: center;
446+
color: var(--color-text-muted);
447+
font-size: 0.9rem;
448+
}
449+
344450
// TOC
345451
.toc {
346452
background-color: var(--color-bg-secondary);

0 commit comments

Comments
 (0)