Files
radicle-explorer/desktop/src/components/TooltipBadge.svelte
T
Rūdolfs Ošiņš 983fff9006 Move everything into desktop/
In preparation for merging radicle-desktop into radicle-gui. It's a pure rename, so git can follow every file across the move.
2026-10-12 08:41:12 +02:00

50 lines
1.2 KiB
Svelte

<script lang="ts">
import type { Snippet } from "svelte";
import HoverPopover from "@app/components/HoverPopover.svelte";
interface Props {
tooltip: string;
badge: Snippet;
tight?: boolean;
}
const { tooltip, badge, tight = false }: Props = $props();
</script>
<style>
.badge {
display: inline-flex;
align-items: center;
flex-shrink: 0;
}
/* HoverPopover wraps its trigger in an inline-block container and a block
button, whose line boxes push the badge off the centre line of whatever
it sits beside. Neither needs a box of its own here. */
.badge :global(.container),
.badge :global([role="button"]) {
display: inline-flex;
align-items: center;
line-height: 0;
}
.tight:not(:first-child) {
margin-left: -0.25rem;
}
.tooltip {
font: var(--txt-body-s-regular);
color: var(--color-text-primary);
white-space: nowrap;
}
</style>
<span class="badge" class:tight>
<HoverPopover stylePadding="0.25rem 0.5rem">
{#snippet toggle()}
{@render badge()}
{/snippet}
{#snippet popover()}
<span class="tooltip">{tooltip}</span>
{/snippet}
</HoverPopover>
</span>