Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sticky-banner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
tredaro: patch
---

Restore the full-width sticky demo banner so it stays visible while scrolling.
17 changes: 16 additions & 1 deletion src/lib/components/app/demo-banner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,25 @@
document.removeEventListener('visibilitychange', update);
};
});

let el: HTMLDivElement;
$effect(() => {
if (!el) return;
const set = () =>
document.documentElement.style.setProperty('--demo-banner-h', `${el.offsetHeight}px`);
set();
const ro = new ResizeObserver(set);
ro.observe(el);
return () => {
ro.disconnect();
document.documentElement.style.removeProperty('--demo-banner-h');
};
});
</script>

<div
class="absolute top-14 left-1/2 z-50 flex -translate-x-1/2 flex-wrap items-center justify-center gap-x-3 gap-y-1 rounded-full bg-primary/95 px-4 py-1.5 text-center text-xs text-primary-foreground shadow-lg backdrop-blur sm:top-2"
bind:this={el}
class="sticky top-0 z-50 flex w-full flex-wrap items-center justify-center gap-x-3 gap-y-1 bg-primary px-4 py-1.5 text-center text-xs text-primary-foreground"
>
<span>
Private demo · {remaining > 0 ? 'Session ends in' : 'Session ended'}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/app/page-header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<svelte:head><title>{title} · Tredaro</title></svelte:head>

<header
class="sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-4 backdrop-blur"
class="sticky top-[var(--demo-banner-h,0px)] z-10 flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 px-4 backdrop-blur"
>
<Sidebar.Trigger class="-ml-1" />
<Separator orientation="vertical" class="mr-1 data-[orientation=vertical]:h-4" />
Expand Down
2 changes: 1 addition & 1 deletion src/routes/(app)/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
deployUrl="https://github.com/maxffarrell/tredaro#quick-start"
/>
{/if}
<main class="min-w-0 flex-1 {data.demo && data.demoExpiresAt ? 'max-sm:pt-10' : ''}">
<main class="min-w-0 flex-1">
{@render children()}
</main>
</Sidebar.Inset>
Expand Down
6 changes: 1 addition & 5 deletions src/routes/portal/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@
>
</div>
</header>
<main
class="mx-auto max-w-3xl space-y-6 p-4 py-8 {data.demo && data.demoExpiresAt
? 'max-sm:pt-14'
: ''}"
>
<main class="mx-auto max-w-3xl space-y-6 p-4 py-8">
<svelte:boundary>
{@render children()}
{#snippet pending()}<Skeleton class="h-40 w-full" />{/snippet}
Expand Down
Loading