Skip to content

Commit

Permalink
NoDocuments
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Feb 29, 2024
1 parent b722c57 commit b6b0b8c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 6 deletions.
59 changes: 59 additions & 0 deletions src/lib/components/documents/NoDocuments.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script>
import { _ } from "svelte-i18n";
// SVG assets
import emptyResultsSvg from "@/assets/empty_results.svg?raw";
</script>

<div class="no-results">
<h2>{$_("noDocuments.noSearchResults")}</h2>
<div class="img">
{@html emptyResultsSvg}
</div>
<div class="text">
<p>
{$_("noDocuments.queryNoResults")}
</p>
</div>
</div>

<style>
.no-results {
margin: 1em 1.5em;
background: var(--yellow-light);
padding: 1em;
border-radius: 10px;
}
h2 {
font-size: 16px;
font-weight: 600;
margin: 1.5em 0;
padding-left: 18px;
}
.img,
.text {
display: inline-block;
vertical-align: top;
}
.text {
max-width: 80ch;
width: 30vw;
margin: 0 2em 1em 2em;
}
.text :global(a) {
color: var(--primary);
}
.text p {
font-size: 15px;
line-height: 22px;
margin: 5px 0;
}
p {
margin: 0 1em;
}
</style>
9 changes: 3 additions & 6 deletions src/lib/components/documents/ResultsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
<script lang="ts">
import type { DocumentResults } from "$lib/api/types";
import DocumentListItem from "./DocumentListItem.svelte";
import { onMount } from "svelte";
import NoDocuments from "./NoDocuments.svelte";
export let results: DocumentResults;
onMount(() => {
// @ts-ignore
window.searchResults = results;
});
</script>

<div class="results">
Expand All @@ -23,6 +18,8 @@
<input type="checkbox" value={document.id} bind:group={$selected} />
<DocumentListItem {document} />
</div>
{:else}
<NoDocuments />
{/each}
</div>

Expand Down

0 comments on commit b6b0b8c

Please sign in to comment.