Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion web-common/src/components/tooltip/TooltipTitle.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
<script lang="ts">
/**
* By default the name is kept on a single line and ellipsized. Set this to
* let long values wrap across multiple lines instead, so the full text is
* readable on hover.
*/
export let wrap = false;
</script>

<div
class="grid gap-x-2 pointer-events-none pt-1 pb-1 items-baseline"
style="grid-template-columns: auto max-content"
style:min-width="200px"
>
<div class="font-bold truncate text-fg-inverse" aria-label="tooltip-name">
<!--
`min-w-0` is required alongside `break-words`: without it the grid item is sized
to its min-content width, and `overflow-wrap: break-word` does not contribute
break opportunities to min-content, so a single unbroken value (a URL, a UUID)
would overflow the tooltip instead of wrapping.
-->
<div
class="font-bold text-fg-inverse"
class:truncate={!wrap}
class:break-words={wrap}
class:min-w-0={wrap}
aria-label="tooltip-name"
>
<slot name="name" />
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{#if hovering.isPin}
{pinned ? "Unpin" : "Pin"} this column to left side of the table
{:else}
<TooltipTitle>
<TooltipTitle wrap={!hovering.isHeader}>
<svelte:fragment slot="name">
{#if hovering.isHeader}
{hovering.value}
Expand Down
Loading