Skip to content

Commit

Permalink
fix error and empty state heights
Browse files Browse the repository at this point in the history
  • Loading branch information
efstajas committed Jan 10, 2025
1 parent 9a80a74 commit ebd00b0
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/lib/components/search-bar/components/results.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<div class="results">
{#if loading}
<div class="loading-state" transition:fade={{ duration: 100 }}><Spinner /></div>
{:else if error}
{/if}

{#if error}
<div class="empty-state">
<Cross />
<p class="typo-text">Sorry, something went wrong while searching.</p>
Expand All @@ -27,12 +29,13 @@
<EyeClosed />
<p class="typo-text">No results</p>
</div>
{:else}
{#each results as result, index}
<div class="result" bind:this={resultElems[index]}>
<ResultComponent on:click item={result} />
</div>
{/each}
{/if}
{#each results as result, index}
<div class="result" bind:this={resultElems[index]}>
<ResultComponent on:click item={result} />
</div>
{/each}
</div>
</TransitionedHeight>

Expand All @@ -52,7 +55,6 @@
width: 100%;
}
.empty-state,
.loading-state {
position: absolute;
background: var(--color-background);
Expand All @@ -66,4 +68,12 @@
flex-direction: column;
z-index: 10;
}
.empty-state {
height: 4rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
</style>

0 comments on commit ebd00b0

Please sign in to comment.