Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 5d4bd4e

Browse files
authored
Svelte: search results styling updates (#61162)
This makes a handful of small styling updates to the Svelte implementation of the search results page to bring it more in line with the designs and the react app. It is not comprehensive, but it takes care of the big things.
1 parent 5479a45 commit 5d4bd4e

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

client/web-sveltekit/src/lib/search/dynamicFilters/CountBadge.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@
3030
{/if}
3131
</span>
3232
{/if}
33+
34+
<style lang="scss">
35+
span.count :global(span) {
36+
background-color: var(--secondary-2);
37+
color: var(--text-muted);
38+
}
39+
</style>

client/web-sveltekit/src/lib/search/dynamicFilters/Section.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@
154154
}
155155
156156
&:hover {
157-
background-color: var(--secondary-4);
157+
background-color: var(--secondary-2);
158158
}
159159
160160
&.selected {

client/web-sveltekit/src/lib/search/dynamicFilters/index.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
mdiCodeTags,
3-
mdiFileCodeOutline,
4-
mdiPlusMinus,
5-
mdiShapeOutline,
6-
mdiSourceCommit,
7-
mdiSourceRepository,
8-
} from '@mdi/js'
1+
import { mdiCodeBraces, mdiFileOutline, mdiFunction, mdiPlusMinus, mdiSourceCommit, mdiSourceFork } from '@mdi/js'
92

103
import type { Filter } from '@sourcegraph/shared/src/search/stream'
114

@@ -90,10 +83,10 @@ export const staticTypeFilters: URLQueryFilter[] = [
9083
]
9184

9285
export const typeFilterIcons: Record<string, string> = {
93-
Code: mdiCodeTags,
94-
Repositories: mdiSourceRepository,
95-
Paths: mdiFileCodeOutline,
96-
Symbols: mdiShapeOutline,
86+
Code: mdiCodeBraces,
87+
Repositories: mdiSourceFork,
88+
Paths: mdiFileOutline,
89+
Symbols: mdiFunction,
9790
Commits: mdiSourceCommit,
9891
Diffs: mdiPlusMinus,
9992
}

client/web-sveltekit/src/routes/search/FileContentSearchResult.svelte

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@
114114
startLine={group.startLine}
115115
matches={group.matches}
116116
plaintextLines={group.plaintextLines}
117+
--background-color="transparent"
117118
/>
118119
{:then result}
119120
<CodeExcerpt
120121
startLine={group.startLine}
121122
matches={group.matches}
122123
plaintextLines={group.plaintextLines}
123124
highlightedHTMLRows={result?.[index]?.slice(0, group.plaintextLines.length)}
125+
--background-color="transparent"
124126
/>
125127
{/await}
126128
</a>
@@ -156,6 +158,10 @@
156158
position: sticky;
157159
bottom: 0;
158160
}
161+
162+
&:hover {
163+
background-color: var(--subtle-bg-2);
164+
}
159165
}
160166
161167
.code {
@@ -165,6 +171,10 @@
165171
border-bottom: none;
166172
}
167173
174+
&:hover {
175+
background-color: var(--subtle-bg-2);
176+
}
177+
168178
a {
169179
text-decoration: none;
170180
color: inherit;

client/web-sveltekit/src/routes/search/PreviewPanel.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,6 @@
152152
153153
.content {
154154
overflow: auto;
155+
background-color: var(--code-bg);
155156
}
156157
</style>

client/web-sveltekit/src/routes/search/RepoSearchResult.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@
7575
{limitDescription(description)}
7676
</p>
7777
{/key}
78-
{/if}
79-
{#if badges.length > 0}
78+
{/if}<!--
79+
Intentional weird comment to avoid adding an empty line to the body
80+
-->{#if badges.length > 0}
8081
<ul class="p-2">
8182
{#each badges as badge}
8283
<li>

client/web-sveltekit/src/routes/search/SearchResult.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
align-items: center;
5858
}
5959
60-
.body {
60+
.body:not(:empty) {
6161
background-color: var(--code-bg);
6262
border-bottom: 1px solid var(--border-color);
6363
}

client/web-sveltekit/src/routes/search/SymbolSearchResult.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@
6666
display: flex;
6767
align-items: center;
6868
width: 100%;
69-
background-color: var(--code-bg);
7069
padding: 0.5rem;
7170
border-bottom: 1px solid var(--border-color);
71+
72+
background-color: var(--code-bg);
73+
&:hover {
74+
background-color: var(--subtle-bg-2);
75+
}
7276
}
7377
7478
.symbol-kind {

0 commit comments

Comments
 (0)