aboutsummaryrefslogtreecommitdiff
path: root/src/components/timeline
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2022-08-17 20:49:20 +0300
committerHenry Jameson <me@hjkos.com>2022-08-17 20:49:20 +0300
commitefc6b6b703971acd9cff7bb452a1fad40b801f87 (patch)
tree43b8262d6335e00db9d0850f6b51e088db21c263 /src/components/timeline
parent2c76c46aa7aa72cf1894f11e7da3fc6e60caabfa (diff)
add "scroll to top" button to timelines and notifications
Diffstat (limited to 'src/components/timeline')
-rw-r--r--src/components/timeline/timeline.js5
-rw-r--r--src/components/timeline/timeline.vue8
2 files changed, 13 insertions, 0 deletions
diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js
index 8f6cae66..6fca869f 100644
--- a/src/components/timeline/timeline.js
+++ b/src/components/timeline/timeline.js
@@ -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),
diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue
index 627cafbb..a6bfeed1 100644
--- a/src/components/timeline/timeline.vue
+++ b/src/components/timeline/timeline.vue
@@ -3,6 +3,14 @@
<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"
@click.prevent="showNewStatuses"