From bab0a5ebf208c932c2c3e5d7561e9c7d6b9f58b1 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:09:47 -0500 Subject: [PATCH 1/9] Creates Search component --- src/lib/components/Search.svelte | 91 +++++++++++++++++++ .../components/stories/Search.stories.svelte | 27 ++++++ 2 files changed, 118 insertions(+) create mode 100644 src/lib/components/Search.svelte create mode 100644 src/lib/components/stories/Search.stories.svelte diff --git a/src/lib/components/Search.svelte b/src/lib/components/Search.svelte new file mode 100644 index 000000000..b60959d78 --- /dev/null +++ b/src/lib/components/Search.svelte @@ -0,0 +1,91 @@ + + +
+ + + +
+ + diff --git a/src/lib/components/stories/Search.stories.svelte b/src/lib/components/stories/Search.stories.svelte new file mode 100644 index 000000000..46c450756 --- /dev/null +++ b/src/lib/components/stories/Search.stories.svelte @@ -0,0 +1,27 @@ + + + + + + From 55b28187bdf6a4b271067b42bed0e79056a6392c Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:10:01 -0500 Subject: [PATCH 2/9] Update styling of DocumentListItem to prevent overflow --- src/lib/components/documents/DocumentListItem.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/components/documents/DocumentListItem.svelte b/src/lib/components/documents/DocumentListItem.svelte index 636335838..0aa79e596 100644 --- a/src/lib/components/documents/DocumentListItem.svelte +++ b/src/lib/components/documents/DocumentListItem.svelte @@ -73,11 +73,13 @@ It's deliberately minimal and can be wrapped in other components to add addition diff --git a/src/lib/components/documents/NoDocuments.svelte b/src/lib/components/documents/NoDocuments.svelte deleted file mode 100644 index 693d713f4..000000000 --- a/src/lib/components/documents/NoDocuments.svelte +++ /dev/null @@ -1,59 +0,0 @@ - - -
-

{$_("noDocuments.noSearchResults")}

-
- -
-
-

- {$_("noDocuments.queryNoResults")} -

-
-
- - diff --git a/src/lib/components/documents/ResultsList.svelte b/src/lib/components/documents/ResultsList.svelte index bfb7befee..7e6bcf46b 100644 --- a/src/lib/components/documents/ResultsList.svelte +++ b/src/lib/components/documents/ResultsList.svelte @@ -1,51 +1,87 @@ -
- {#each results.results as document (document.id)} -
- - - -
- {:else} - - {/each} +
+
+ +
+
+ {#each results.results as document (document.id)} + + updateSelection(event, document.id)} + /> + + + {:else} + +

{$_("noDocuments.noSearchResults")}

+

{$_("noDocuments.queryNoResults")}

+
+ {/each} +
+
+ +
diff --git a/src/lib/components/documents/stories/ResultsList.stories.svelte b/src/lib/components/documents/stories/ResultsList.stories.svelte index 20f1610ea..af305ba26 100644 --- a/src/lib/components/documents/stories/ResultsList.stories.svelte +++ b/src/lib/components/documents/stories/ResultsList.stories.svelte @@ -24,9 +24,9 @@ - +
- +
diff --git a/src/lib/components/stories/MainLayout.stories.svelte b/src/lib/components/stories/MainLayout.stories.svelte index 8c885a747..9388b3e09 100644 --- a/src/lib/components/stories/MainLayout.stories.svelte +++ b/src/lib/components/stories/MainLayout.stories.svelte @@ -1,7 +1,7 @@ -
-
- -
-
- {#each results.results as document (document.id)} - - updateSelection(event, document.id)} - /> - - - {:else} - -

{$_("noDocuments.noSearchResults")}

-

{$_("noDocuments.queryNoResults")}

-
- {/each} -
-
- -
-
- - +{#if !results} + Loading… +{:else} + {#each results.results as document (document.id)} + + updateSelection(event, document.id)} + /> + + + {:else} + +

{$_("noDocuments.noSearchResults")}

+

{$_("noDocuments.queryNoResults")}

+
+ {/each} +{/if} diff --git a/src/lib/components/documents/stories/ResultsList.stories.svelte b/src/lib/components/documents/stories/ResultsList.stories.svelte index af305ba26..4b4b99dea 100644 --- a/src/lib/components/documents/stories/ResultsList.stories.svelte +++ b/src/lib/components/documents/stories/ResultsList.stories.svelte @@ -23,10 +23,14 @@ }; - +
- +
+ + +
+
diff --git a/src/lib/components/stories/MainLayout.stories.svelte b/src/lib/components/stories/MainLayout.stories.svelte index 9388b3e09..3047010fb 100644 --- a/src/lib/components/stories/MainLayout.stories.svelte +++ b/src/lib/components/stories/MainLayout.stories.svelte @@ -20,14 +20,16 @@ import SidebarItem from "$lib/components/sidebar/SidebarItem.svelte"; import documents from "../../api/fixtures/documents/documents.json"; - import DocumentListItem from "../documents/DocumentListItem.svelte"; import Flex from "../common/Flex.svelte"; import SidebarGroup from "../sidebar/SidebarGroup.svelte"; import Action from "../common/Action.svelte"; import Pin from "@/common/Pin.svelte"; import ResultsList from "../documents/ResultsList.svelte"; + import ContentLayout from "../ContentLayout.svelte"; + import PageToolbar from "../common/PageToolbar.svelte"; + import Search from "../Search.svelte"; - let docList = documents as DocumentResults; + let results = documents as DocumentResults; export const meta = { title: "Components / Main Layout", @@ -72,9 +74,13 @@ - - - + + + + + + + diff --git a/src/routes/app/+page.svelte b/src/routes/app/+page.svelte index 16d78636b..dd6e2b1de 100644 --- a/src/routes/app/+page.svelte +++ b/src/routes/app/+page.svelte @@ -20,6 +20,9 @@ import Action from "$lib/components/common/Action.svelte"; import Pin from "@/common/Pin.svelte"; import ResultsList from "@/lib/components/documents/ResultsList.svelte"; + import ContentLayout from "@/lib/components/ContentLayout.svelte"; + import PageToolbar from "@/lib/components/common/PageToolbar.svelte"; + import Search from "@/lib/components/Search.svelte"; export let data; @@ -68,13 +71,17 @@ - + + + + {#await searchResults} -

Loading ...

+ {:then results} {/await} -
+ + From 5e2e9a436d92e2b089d0a029d2b1fbbd0e397170 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:37:30 -0500 Subject: [PATCH 5/9] Fix mis-slotted Search in top toolbar --- src/routes/app/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/app/+page.svelte b/src/routes/app/+page.svelte index dd6e2b1de..9cf31db83 100644 --- a/src/routes/app/+page.svelte +++ b/src/routes/app/+page.svelte @@ -73,7 +73,7 @@ - + {#await searchResults} From 1a6e2c7b9568d37481d96f345c63d17c1a5cc293 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:44:00 -0500 Subject: [PATCH 6/9] Prevent ContentLayout header and footer from growing --- src/lib/components/ContentLayout.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/ContentLayout.svelte b/src/lib/components/ContentLayout.svelte index fb1127b7d..df8301883 100644 --- a/src/lib/components/ContentLayout.svelte +++ b/src/lib/components/ContentLayout.svelte @@ -25,7 +25,7 @@ position: relative; } header { - flex: 1 0 0; + flex: 0 0 0; width: 100%; position: sticky; top: 0; @@ -37,10 +37,10 @@ display: flex; flex-direction: column; justify-content: center; - padding: 0 1.25rem; + padding: 0 1.25jrem; } footer { - flex: 1 0 0; + flex: 0 0 0; width: 100%; position: sticky; bottom: 0; From 296341eeb1834467a11d51ec7607f6392cb671c4 Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:46:23 -0500 Subject: [PATCH 7/9] Fix content padding --- src/lib/components/ContentLayout.svelte | 1 - .../components/documents/ResultsList.svelte | 42 +++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/lib/components/ContentLayout.svelte b/src/lib/components/ContentLayout.svelte index df8301883..6f2a4a1bb 100644 --- a/src/lib/components/ContentLayout.svelte +++ b/src/lib/components/ContentLayout.svelte @@ -37,7 +37,6 @@ display: flex; flex-direction: column; justify-content: center; - padding: 0 1.25jrem; } footer { flex: 0 0 0; diff --git a/src/lib/components/documents/ResultsList.svelte b/src/lib/components/documents/ResultsList.svelte index dcad75570..0e940a33c 100644 --- a/src/lib/components/documents/ResultsList.svelte +++ b/src/lib/components/documents/ResultsList.svelte @@ -25,21 +25,29 @@ } -{#if !results} - Loading… -{:else} - {#each results.results as document (document.id)} - - updateSelection(event, document.id)} - /> - - +
+ {#if !results} + Loading… {:else} - -

{$_("noDocuments.noSearchResults")}

-

{$_("noDocuments.queryNoResults")}

-
- {/each} -{/if} + {#each results.results as document (document.id)} + + updateSelection(event, document.id)} + /> + + + {:else} + +

{$_("noDocuments.noSearchResults")}

+

{$_("noDocuments.queryNoResults")}

+
+ {/each} + {/if} +
+ + From 30efc9f3a3cce11a9ffee8f3c26be96b4b5b47cf Mon Sep 17 00:00:00 2001 From: Allan Lasser Date: Thu, 29 Feb 2024 14:53:25 -0500 Subject: [PATCH 8/9] Move loading state out of ResultsList --- .../components/documents/ResultsList.svelte | 32 ++++++++----------- .../stories/ResultsList.stories.svelte | 4 --- src/routes/app/+page.svelte | 12 ++++--- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/src/lib/components/documents/ResultsList.svelte b/src/lib/components/documents/ResultsList.svelte index 0e940a33c..f0fd5ccd1 100644 --- a/src/lib/components/documents/ResultsList.svelte +++ b/src/lib/components/documents/ResultsList.svelte @@ -10,7 +10,7 @@ import DocumentListItem from "./DocumentListItem.svelte"; import Flex from "../common/Flex.svelte"; import Checkbox from "../common/Checkbox.svelte"; - import { Hourglass24, Search24 } from "svelte-octicons"; + import { Search24 } from "svelte-octicons"; import Empty from "../common/Empty.svelte"; export let results: DocumentResults = undefined; @@ -26,24 +26,20 @@
- {#if !results} - Loading… + {#each results.results as document (document.id)} + + updateSelection(event, document.id)} + /> + + {:else} - {#each results.results as document (document.id)} - - updateSelection(event, document.id)} - /> - - - {:else} - -

{$_("noDocuments.noSearchResults")}

-

{$_("noDocuments.queryNoResults")}

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

{$_("noDocuments.noSearchResults")}

+

{$_("noDocuments.queryNoResults")}

+
+ {/each}