Skip to content

Commit

Permalink
dynamic header height calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
MrVauxs committed Dec 21, 2023
1 parent dd75f47 commit 02301bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/components/ItemList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,14 @@
next?.scrollIntoView({ block: 'center' });
}
}
let headerHeight = 0;
</script>

<svelte:window on:keydown={move} />

<div class="card flex flex-col">
<div class="sticky top-0 h-14">
<div class="card flex flex-col" style="--headerHeight: {headerHeight}px">
<div class="sticky top-0" bind:clientHeight={headerHeight}>
<div>
<div class="input-group input-group-divider flex flex-row rounded-b-none">
<div class="input-group-shim !p-0">
Expand Down Expand Up @@ -114,7 +116,7 @@
</div>
</div>
<div
class="h-[calc(var(--slotHeight)_-_3.625rem)] overflow-y-scroll offset-scroll scroll-thin
class="h-[calc(var(--slotHeight)_-_var(--headerHeight))] overflow-y-scroll offset-scroll scroll-thin
[&_button:nth-child(odd)]:bg-surface-200/50 dark:[&_button:nth-child(odd)]:bg-surface-700/50"
>
{#each filteredItems as item}
Expand Down

0 comments on commit 02301bf

Please sign in to comment.