feat(search): make styling more configurable, align more with the theme (#2233)

Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com>
pull/2239/head
Anthony Fu 2 years ago committed by GitHub
parent 185213c6ba
commit b2077c7025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -536,7 +536,8 @@ useEventListener('popstate', (event) => {
.backdrop { .backdrop {
position: absolute; position: absolute;
inset: 0; inset: 0;
background: rgba(0, 0, 0, 0.5); background: var(--vp-backdrop-bg-color);
transition: opacity 0.5s;
} }
.shell { .shell {
@ -546,7 +547,7 @@ useEventListener('popstate', (event) => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
background: var(--vp-c-bg); background: var(--vp-local-search-bg);
width: min(100vw - 60px, 900px); width: min(100vw - 60px, 900px);
height: min-content; height: min-content;
max-height: min(100vh - 128px, 900px); max-height: min(100vh - 128px, 900px);
@ -564,7 +565,7 @@ useEventListener('popstate', (event) => {
} }
.search-bar { .search-bar {
border: 1px solid rgba(128, 128, 128, 0.2); border: 1px solid var(--vp-c-divider);
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
align-items: center; align-items: center;
@ -675,7 +676,7 @@ useEventListener('popstate', (event) => {
border-radius: 4px; border-radius: 4px;
transition: none; transition: none;
line-height: 1rem; line-height: 1rem;
border: solid 2px rgba(128, 128, 128, 0.05); border: solid 2px var(--vp-local-search-result-border);
} }
.result > div { .result > div {
@ -720,7 +721,8 @@ useEventListener('popstate', (event) => {
} }
.result.selected { .result.selected {
border-color: var(--vp-c-brand); --vp-local-search-result-bg: var(--vp-local-search-result-selected-bg);
border-color: var(--vp-local-search-result-selected-border);
} }
.excerpt-wrapper { .excerpt-wrapper {
@ -748,10 +750,10 @@ useEventListener('popstate', (event) => {
.titles :deep(mark), .titles :deep(mark),
.excerpt :deep(mark) { .excerpt :deep(mark) {
background-color: var(--vp-c-highlight-bg); background-color: var(--vp-local-search-highlight-bg);
color: var(--vp-c-highlight-text); color: var(--vp-local-search-highlight-text);
border-radius: 2px; border-radius: 2px;
padding: 0 4px; padding: 0 2px;
} }
.excerpt :deep(.vp-code-group) .tabs { .excerpt :deep(.vp-code-group) .tabs {
@ -768,7 +770,7 @@ useEventListener('popstate', (event) => {
left: 0; left: 0;
width: 100%; width: 100%;
height: 8px; height: 8px;
background: linear-gradient(transparent, var(--vp-c-bg)); background: linear-gradient(transparent, var(--vp-local-search-result-bg));
z-index: 1000; z-index: 1000;
} }
@ -778,7 +780,7 @@ useEventListener('popstate', (event) => {
left: 0; left: 0;
width: 100%; width: 100%;
height: 8px; height: 8px;
background: linear-gradient(var(--vp-c-bg), transparent); background: linear-gradient(var(--vp-local-search-result-bg), transparent);
z-index: 1000; z-index: 1000;
} }

@ -97,9 +97,6 @@
--vp-c-mute-lighter: #ffffff; --vp-c-mute-lighter: #ffffff;
--vp-c-mute-dark: #e3e3e5; --vp-c-mute-dark: #e3e3e5;
--vp-c-mute-darker: #d7d7d9; --vp-c-mute-darker: #d7d7d9;
--vp-c-highlight-bg: var(--vp-c-green-lighter);
--vp-c-highlight-text: var(--vp-c-black);
} }
.dark { .dark {
@ -414,3 +411,16 @@
--vp-carbon-ads-hover-text-color: var(--vp-c-brand); --vp-carbon-ads-hover-text-color: var(--vp-c-brand);
--vp-carbon-ads-hover-poweredby-color: var(--vp-c-text-1); --vp-carbon-ads-hover-poweredby-color: var(--vp-c-text-1);
} }
/**
* Component: Local Search
* -------------------------------------------------------------------------- */
:root {
--vp-local-search-bg: var(--vp-c-bg);
--vp-local-search-result-bg: var(--vp-c-bg);
--vp-local-search-result-border: var(--vp-c-divider);
--vp-local-search-result-selected-bg: var(--vp-c-bg);
--vp-local-search-result-selected-border: var(--vp-c-brand);
--vp-local-search-highlight-bg: var(--vp-c-green-lighter);
--vp-local-search-highlight-text: var(--vp-c-black);
}

Loading…
Cancel
Save