add scroll down button
Deploy app frontend / app frontend (push) Successful in 1m51s

This commit is contained in:
2025-05-15 14:23:11 +02:00
parent 6a2015776c
commit 4c54aee2fe
+16 -1
View File
@@ -16,6 +16,7 @@
<div class="sm:max-w-prose grid grid-cols-1 mx-auto my-5 w-full"> <div class="sm:max-w-prose grid grid-cols-1 mx-auto my-5 w-full">
<div ref="isTopOfContentRef" /> <div ref="isTopOfContentRef" />
<slot name="default" v-bind:scrollToBottom /> <slot name="default" v-bind:scrollToBottom />
<div ref="isBottomOfContentRef" /> <div ref="isBottomOfContentRef" />
</div> </div>
</div> </div>
@@ -26,6 +27,17 @@
:class="{ 'opacity-100': !isBottomOfContentVisible }" :class="{ 'opacity-100': !isBottomOfContentVisible }"
/> />
<!-- Scroll to bottom -->
<Button
icon="pi pi-arrow-down"
rounded
variant="outlined"
severity="secondary"
class="transition-opacity opacity-0 row-start-3 row-span-1 col-start-1 sm:row-start-4 relative self-end mb-4 bg-red-900 place-self-center"
@click="scrollToBottom"
:class="{ 'opacity-100': !isBottomOfContentVisible }"
/>
<!-- Footer Section --> <!-- Footer Section -->
<div class="row-start-4 row-span-1 col-start-1 sm:row-start-5"> <div class="row-start-4 row-span-1 col-start-1 sm:row-start-5">
<slot name="footer"> <slot name="footer">
@@ -75,7 +87,10 @@ isBottomOfContentVisible.value = true
const scrollToBottom = () => { const scrollToBottom = () => {
if (contentScrollContainerRef.value) { if (contentScrollContainerRef.value) {
contentScrollContainerRef.value.scrollTop = contentScrollContainerRef.value.scrollHeight contentScrollContainerRef.value.scrollTo({
top: contentScrollContainerRef.value.scrollHeight,
behavior: 'smooth',
})
} }
} }