From af2f3f99b1a4bc9062499cd9cfa92430fe114361 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 5 Dec 2024 14:57:13 -0500 Subject: [PATCH] Really lean into DocumentListItem customization --- src/lib/components/common/KV.svelte | 52 +++-- .../documents/DocumentListItem.svelte | 178 +++++++++++++----- .../stories/DocumentListItem.stories.svelte | 113 ++++++++++- .../components/viewer/AnnotationLayer.svelte | 3 +- src/lib/components/viewer/NoteTab.svelte | 7 +- src/test/fixtures/documents.ts | 12 +- 6 files changed, 290 insertions(+), 75 deletions(-) diff --git a/src/lib/components/common/KV.svelte b/src/lib/components/common/KV.svelte index d8400cb0e..954972d4d 100644 --- a/src/lib/components/common/KV.svelte +++ b/src/lib/components/common/KV.svelte @@ -4,49 +4,63 @@ export let href: null | string = null; export let inline: boolean = false; export let tag: boolean = false; + + let el = href ? "a" : "span"; -
+ {#if !tag} {key} {/if} - {#if href} - {value} - {:else} - {value} - {/if} + {value} -
+ diff --git a/src/lib/components/viewer/AnnotationLayer.svelte b/src/lib/components/viewer/AnnotationLayer.svelte index 45fe77f44..5ebabb4a5 100644 --- a/src/lib/components/viewer/AnnotationLayer.svelte +++ b/src/lib/components/viewer/AnnotationLayer.svelte @@ -33,6 +33,7 @@ Assumes it's a child of a ViewerContext isEmbedded, } from "$lib/components/viewer/ViewerContext.svelte"; import { getNotes, getViewerHref } from "$lib/utils/viewer"; + import Tooltip from "../common/Tooltip.svelte"; export let scale = 1.5; export let page_number: number; // zero-indexed @@ -201,7 +202,7 @@ Assumes it's a child of a ViewerContext style:top="calc({note.y1} * 100%)" on:click={(e) => openNote(e, note)} > - + - -
-
+