Add delegate info to peer selector

This commit also adds a highlight to the currently selected peer and
branch.

Signed-off-by: Sebastian Martinez <sebastinez@me.com>
Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Sebastian Martinez
2022-02-23 15:09:21 +01:00
committed by Alexis Sellier
parent d69907be45
commit 856b53dae8
7 changed files with 149 additions and 21 deletions
+13 -5
View File
@@ -1,7 +1,8 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
export let items: string[];
export let items: { key: string; value: string; badge: string | null }[];
export let selected: string | null;
export let visible = false;
const dispatch = createEventDispatcher();
@@ -17,15 +18,18 @@
margin-top: 0.5rem;
border-radius: 0.25rem;
position: absolute;
box-shadow: 8px 8px 24px var(--color-shadow);
box-shadow: 16px 16px 32px 32px var(--color-shadow);
}
.dropdown-item {
cursor: pointer;
padding: 0.5rem 1rem;
}
.dropdown-item:hover {
.dropdown-item:hover, .selected {
background-color: var(--color-foreground-background-lighter);
}
.dropdown .badge {
margin: 0;
}
@media (max-width: 720px) {
.dropdown {
@@ -37,8 +41,12 @@
{#if visible}
<div class="dropdown">
{#each items as item}
<div class="dropdown-item" on:click={() => onSelect(item)}>{item}</div>
{#each items as {key, value, badge}}
<div class="dropdown-item" class:selected={value === selected} on:click={() => onSelect(value)} title={value}>{@html key}
{#if badge}
<span class="badge primary">{badge}</span>
{/if}
</div>
{/each}
</div>
{/if}