Skip to content

Commit db8e19e

Browse files
[Search] - Iterating on search results styling
1 parent 5ffd3ea commit db8e19e

2 files changed

Lines changed: 109 additions & 3 deletions

File tree

web/search.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
overlay.className = 'search-modal-overlay';
1616
overlay.innerHTML =
1717
'<div class="search-modal" role="dialog" aria-modal="true" aria-label="Search">' +
18+
'<div class="search-modal-header">' +
19+
'<span class="search-modal-title">Search</span>' +
20+
'<button type="button" class="search-modal-close" aria-label="Close search">&times;</button>' +
21+
'</div>' +
1822
'<div id="pagefind-search"></div>' +
1923
'</div>';
2024
overlay.addEventListener('click', function (e) {
2125
if (e.target === overlay) closeModal();
2226
});
27+
overlay.querySelector('.search-modal-close').addEventListener('click', closeModal);
2328
document.body.appendChild(overlay);
2429
return overlay;
2530
}

web/styles.css

Lines changed: 104 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
--radius-lg: 14px;
2020
--radius-xl: 20px;
2121
--radius-full: 9999px;
22+
color-scheme: dark;
2223
}
2324

2425
*, *::before, *::after {
@@ -822,6 +823,7 @@ body {
822823
body.search-modal-active { overflow: hidden; }
823824

824825
.search-modal {
826+
position: relative;
825827
width: 100%;
826828
max-width: 640px;
827829
max-height: 70vh;
@@ -830,18 +832,117 @@ body.search-modal-active { overflow: hidden; }
830832
border: 1px solid var(--border);
831833
border-radius: var(--radius-lg);
832834
box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
833-
padding: 0.5rem;
835+
padding: 1.25rem 1.25rem 1.5rem;
836+
}
837+
.search-modal::before {
838+
content: '';
839+
position: absolute;
840+
top: 0; left: 0; right: 0;
841+
height: 1px;
842+
background: linear-gradient(90deg, transparent 10%, rgba(91, 141, 238, 0.45) 50%, transparent 90%);
843+
}
844+
845+
.search-modal-header {
846+
display: flex;
847+
align-items: center;
848+
justify-content: space-between;
849+
margin-bottom: 0.875rem;
850+
}
851+
.search-modal-title {
852+
font-family: 'JetBrains Mono', monospace;
853+
font-size: 0.75rem;
854+
font-weight: 500;
855+
letter-spacing: 0.06em;
856+
text-transform: uppercase;
857+
color: var(--text-muted);
858+
}
859+
.search-modal-close {
860+
display: flex;
861+
align-items: center;
862+
justify-content: center;
863+
width: 26px;
864+
height: 26px;
865+
border: none;
866+
background: transparent;
867+
color: var(--text-muted);
868+
font-size: 1.25rem;
869+
line-height: 1;
870+
cursor: pointer;
871+
border-radius: var(--radius-sm);
872+
transition: background 0.15s, color 0.15s;
873+
}
874+
.search-modal-close:hover {
875+
background: rgba(255, 255, 255, 0.06);
876+
color: var(--text-primary);
834877
}
835878

836879
/* Pagefind UI theme — matches the site's dark palette. */
837880
#pagefind-search {
838-
--pagefind-ui-scale: 0.92;
881+
--pagefind-ui-scale: 0.78;
839882
--pagefind-ui-primary: var(--accent-light);
840883
--pagefind-ui-text: var(--text-primary);
841-
--pagefind-ui-background: var(--bg-surface);
884+
--pagefind-ui-background: var(--bg-elevated);
842885
--pagefind-ui-border: var(--border);
843886
--pagefind-ui-tag: var(--bg-elevated);
844887
--pagefind-ui-border-width: 1px;
845888
--pagefind-ui-border-radius: var(--radius-sm);
846889
--pagefind-ui-font: 'Inter', sans-serif;
847890
}
891+
892+
#pagefind-search .pagefind-ui__search-input {
893+
font-weight: 500;
894+
color: var(--text-primary);
895+
transition: border-color 0.15s;
896+
}
897+
#pagefind-search .pagefind-ui__search-input::placeholder {
898+
color: var(--text-muted);
899+
opacity: 1;
900+
}
901+
#pagefind-search .pagefind-ui__search-input:focus-visible {
902+
outline: none;
903+
border-color: var(--border-accent);
904+
}
905+
#pagefind-search .pagefind-ui__search-clear {
906+
color: var(--text-muted);
907+
}
908+
#pagefind-search .pagefind-ui__search-clear:hover {
909+
color: var(--text-secondary);
910+
}
911+
#pagefind-search .pagefind-ui__result-link {
912+
font-family: 'Inter', sans-serif;
913+
font-weight: 600;
914+
transition: color 0.15s;
915+
}
916+
#pagefind-search .pagefind-ui__result-link:hover {
917+
color: var(--accent-light);
918+
text-decoration: none;
919+
}
920+
#pagefind-search .pagefind-ui__result-excerpt {
921+
color: var(--text-secondary);
922+
line-height: 1.6;
923+
}
924+
#pagefind-search .pagefind-ui__result-excerpt mark {
925+
background: rgba(91, 141, 238, 0.18);
926+
color: var(--accent-light);
927+
border-radius: 3px;
928+
padding: 0 0.15em;
929+
}
930+
#pagefind-search .pagefind-ui__message {
931+
color: var(--text-muted);
932+
font-family: 'JetBrains Mono', monospace;
933+
font-weight: 400;
934+
font-size: 0.75rem;
935+
letter-spacing: 0.02em;
936+
text-transform: uppercase;
937+
}
938+
#pagefind-search .pagefind-ui__button {
939+
background: var(--accent);
940+
border-color: rgba(91, 141, 238, 0.28);
941+
color: #ffffff;
942+
font-weight: 500;
943+
}
944+
#pagefind-search .pagefind-ui__button:hover {
945+
background: var(--accent-dim);
946+
border-color: var(--accent-dim);
947+
color: #ffffff;
948+
}

0 commit comments

Comments
 (0)