Skip to content

Commit

Permalink
fix layout and pull to refresh issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cmintey committed Oct 30, 2024
1 parent a180f89 commit 5b7117b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app.postcss
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

html,
body {
@apply h-full;
@apply h-full overscroll-none;
}

a:not(.unstyled):is(:not(.prose *)):not(.btn):not(.btn-icon):not(.app-bar a):not(.logo-item):not(a.card):not(
Expand Down
8 changes: 7 additions & 1 deletion src/lib/components/navigation/BottomTabs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{#if user && $isInstalled}
<TabGroup
class="bg-surface-200-700-token w-full pb-6 pt-4 md:hidden"
class="bottom-nav bg-surface-200-700-token w-full pt-4 md:hidden"
active="variant-glass-primary"
border=""
hover="hover:variant-soft-primary"
Expand All @@ -32,3 +32,9 @@
{/each}
</TabGroup>
{/if}

<style global>
.bottom-nav {
padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
</style>
12 changes: 7 additions & 5 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@
initializeStores();
onMount(() => {
$isInstalled = true;
if (window.matchMedia("(display-mode: standalone)").matches) {
$isInstalled = true;
const ptr = PullToRefresh.init({
mainElement: document.getElementById("main") as unknown as string,
distThreshold: 70,
resistanceFunction: (t) => Math.min(1, t / 4.5),
shouldPullToRefresh: () => window.scrollY === 0,
shouldPullToRefresh: () => document.getElementById("main")?.scrollTop === 0,
onRefresh() {
window.location.reload();
}
Expand Down Expand Up @@ -90,22 +92,22 @@

<Drawer />

<div>
<header class="sticky top-0 z-10">
<div class="flex h-screen flex-col overflow-hidden">
<header class="w-full">
{#if showNavigationLoadingBar}
<NavigationLoadingBar />
{/if}
<NavBar {navItems} user={data.user} />
</header>

<main id="main" class="px-4 py-4 md:px-12 lg:px-32 xl:px-56" class:pb-32={$isInstalled}>
<main id="main" class="flex-1 overflow-y-scroll px-4 py-4 md:px-12 lg:px-32 xl:px-56">
{#if !$isInstalled && !disabled && documentTitle}
<h1 class="h1 pb-2 md:pb-4">{documentTitle}</h1>
{/if}
{@render children?.()}
</main>

<footer class="fixed bottom-0 z-10 w-full">
<footer class="w-full">
<BottomTabs {navItems} user={data.user} />
</footer>
</div>
Expand Down

0 comments on commit 5b7117b

Please sign in to comment.