From fdfcaecc1608b61262ceba0585dfcddcaeefb109 Mon Sep 17 00:00:00 2001 From: Chris Amico Date: Fri, 19 Apr 2024 20:43:02 -0400 Subject: [PATCH] wrap in details/summary --- .../components/documents/ResultsList.svelte | 9 ++-- .../documents/SearchHighlights.svelte | 45 ++++++++++++------- .../stories/ResultsList.stories.svelte | 9 +++- .../stories/SearchHighlights.stories.svelte | 6 ++- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/lib/components/documents/ResultsList.svelte b/src/lib/components/documents/ResultsList.svelte index b43570591..e701b6619 100644 --- a/src/lib/components/documents/ResultsList.svelte +++ b/src/lib/components/documents/ResultsList.svelte @@ -14,12 +14,13 @@ import { onMount } from "svelte"; import { _ } from "svelte-i18n"; + import { Search24 } from "svelte-octicons"; - import DocumentListItem from "./DocumentListItem.svelte"; import Button from "../common/Button.svelte"; - import Flex from "../common/Flex.svelte"; - import { Search24 } from "svelte-octicons"; + import DocumentListItem from "./DocumentListItem.svelte"; import Empty from "../common/Empty.svelte"; + import Flex from "../common/Flex.svelte"; + import SearchHighlights from "./SearchHighlights.svelte"; export let results: Document[] = []; export let count: number = undefined; @@ -96,6 +97,8 @@ /> + + {:else} diff --git a/src/lib/components/documents/SearchHighlights.svelte b/src/lib/components/documents/SearchHighlights.svelte index 84949629c..4ff07d04f 100644 --- a/src/lib/components/documents/SearchHighlights.svelte +++ b/src/lib/components/documents/SearchHighlights.svelte @@ -1,3 +1,16 @@ + + -{#each Object.entries(highlights) as [page, segments]} - {@const [number, href] = pageLink(page)} -

{$_("document.page")} {number}

-
- {#each segments as segment} -

{@html segment}

+{#if count} +
+ {$_("document.matchingPages", { values: { n: count } })} + + {#each Object.entries(highlights) as [page, segments]} + {@const [number, href] = pageLink(page)} +

{$_("document.page")} {number}

+
+ {#each segments as segment} +

{@html segment}

+ {/each} +
{/each} -
-{/each} + +{/if}