-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Svelte: add repo popovers to repo name in header and in dynamic filte…
…rs (#62865) This adds the RepoPopover hover info to the dynamic filters in the search sidebar (replacing the full repo name tooltip) and to the global header.
- Loading branch information
1 parent
1ea4321
commit 376cc7a
Showing
5 changed files
with
139 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
client/web-sveltekit/src/lib/search/dynamicFilters/SectionItem.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<script lang="ts"> | ||
import { mdiClose } from '@mdi/js' | ||
import { page } from '$app/stores' | ||
import Icon from '$lib/Icon.svelte' | ||
import CountBadge from './CountBadge.svelte' | ||
import { updateFilterInURL, type SectionItemData } from './index' | ||
export let item: SectionItemData | ||
export let onFilterSelect: (kind: SectionItemData['kind']) => void = () => {} | ||
</script> | ||
|
||
<a | ||
href={updateFilterInURL($page.url, item, item.selected).toString()} | ||
class:selected={item.selected} | ||
on:click={() => onFilterSelect(item.kind)} | ||
> | ||
<span class="label"> | ||
<slot name="label" label={item.label} value={item.value}> | ||
{item.label} | ||
</slot> | ||
</span> | ||
<CountBadge count={item.count} exhaustive={item.exhaustive} /> | ||
{#if item.selected} | ||
<span class="close"> | ||
<Icon svgPath={mdiClose} inline /> | ||
</span> | ||
{/if} | ||
</a> | ||
|
||
<style lang="scss"> | ||
a { | ||
display: flex; | ||
width: 100%; | ||
align-items: center; | ||
border: none; | ||
text-align: left; | ||
text-decoration: none; | ||
border-radius: var(--border-radius); | ||
color: inherit; | ||
white-space: nowrap; | ||
gap: 0.25rem; | ||
padding: 0.25rem 0.5rem; | ||
margin: 0; | ||
font-weight: 400; | ||
.label { | ||
flex: 1; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
color: var(--text-body); | ||
} | ||
&:hover { | ||
background-color: var(--color-bg-3); | ||
.label { | ||
color: var(--text-title); | ||
} | ||
} | ||
&.selected { | ||
background-color: var(--primary); | ||
color: var(--light-text); | ||
--color: var(--light-text); | ||
.label { | ||
color: var(--light-text); | ||
} | ||
} | ||
.close { | ||
flex-shrink: 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters