add "scroll to top" button to timelines and notifications

This commit is contained in:
Henry Jameson 2022-08-17 20:49:20 +03:00
commit efc6b6b703
4 changed files with 44 additions and 3 deletions

View file

@ -29,6 +29,7 @@ const Timeline = {
],
data () {
return {
showScrollTop: false,
paused: false,
unfocused: false,
bottomedOut: false,
@ -123,6 +124,9 @@ const Timeline = {
this.$store.commit('setLoading', { timeline: this.timelineName, value: false })
},
methods: {
scrollToTop () {
window.scrollTo({ top: this.$el.offsetTop })
},
stopBlockingClicks: debounce(function () {
this.blockingClicks = false
}, 1000),
@ -222,6 +226,7 @@ const Timeline = {
}
},
handleScroll: throttle(function (e) {
this.showScrollTop = this.$el.offsetTop < window.scrollY
this.determineVisibleStatuses()
this.scrollLoad(e)
}, 200),

View file

@ -2,6 +2,14 @@
<div :class="['Timeline', classes.root]">
<div :class="classes.header">
<TimelineMenu v-if="!embedded" />
<button
v-if="showScrollTop"
class="button-unstyled scroll-to-top-button"
type="button"
@click="scrollToTop"
>
<FAIcon icon="circle-up" />
</button>
<button
v-if="showLoadButton"
class="button-default loadmore-button"