Description
Add a floating button that appears when scrolled down to quickly return to the top of the page.
Why Needed
- Long result lists require scrolling
- Quick navigation back to search
- Common UX pattern
Implementation Details
- Show button after scrolling 300-500px
- Fixed position bottom-right
- Smooth scroll animation to top
- Fade in/out transition
Files to Create/Modify
src/components/shared/ScrollToTop.svelte (new)
src/layouts/Layout.astro or main component
Code Example
<script>
let showButton = false;
function handleScroll() {
showButton = window.scrollY > 400;
}
function scrollToTop() {
window.scrollTo({ top: 0, behavior: 'smooth' });
}
</script>
<svelte:window on:scroll={handleScroll} />
{#if showButton}
<button onclick={scrollToTop} class="fixed bottom-4 right-4">
<ArrowUpIcon />
</button>
{/if}
Acceptance Criteria
Time Estimates
- With AI: 135 minutes
- Without AI: 900 minutes
Description
Add a floating button that appears when scrolled down to quickly return to the top of the page.
Why Needed
Implementation Details
Files to Create/Modify
src/components/shared/ScrollToTop.svelte(new)src/layouts/Layout.astroor main componentCode Example
Acceptance Criteria
Time Estimates