Add button to go back to top

Fixes #72
This commit is contained in:
Zed 2019-10-13 20:17:12 +02:00
parent ed03fe0a4a
commit a5c0fc3d72
2 changed files with 28 additions and 2 deletions

View file

@ -7,8 +7,8 @@
.timeline { .timeline {
background-color: $bg_panel; background-color: $bg_panel;
> div:not(:last-child) { > div:not(:first-child) {
border-bottom: 1px solid $border_grey; border-top: 1px solid $border_grey;
} }
} }
@ -121,6 +121,26 @@
} }
} }
.top-ref {
background-color: #0f0f0f;
border-top: none !important;
.icon-down {
font-size: 20px;
display: flex;
justify-content: center;
text-decoration: none;
&:hover {
color: $accent_light;
}
&::before {
transform: rotate(180deg) translateY(-1px);
}
}
}
.timeline-item { .timeline-item {
overflow-wrap: break-word; overflow-wrap: break-word;
border-left-width: 0; border-left-width: 0;

View file

@ -32,6 +32,10 @@ proc renderNoneFound(): VNode =
h2(class="timeline-none"): h2(class="timeline-none"):
text "No items found" text "No items found"
proc renderToTop(): VNode =
buildHtml(tdiv(class="top-ref")):
icon "down", href="#"
proc renderThread(thread: seq[Tweet]; prefs: Prefs; path: string): VNode = proc renderThread(thread: seq[Tweet]; prefs: Prefs; path: string): VNode =
buildHtml(tdiv(class="thread-line")): buildHtml(tdiv(class="thread-line")):
for i, threadTweet in thread.sortedByIt(it.id): for i, threadTweet in thread.sortedByIt(it.id):
@ -68,6 +72,7 @@ proc renderTimelineUsers*(results: Result[Profile]; prefs: Prefs; path=""): VNod
renderUser(user, prefs) renderUser(user, prefs)
if results.minId != "0": if results.minId != "0":
renderMore(results.query, results.minId) renderMore(results.query, results.minId)
renderToTop()
elif results.beginning: elif results.beginning:
renderNoneFound() renderNoneFound()
else: else:
@ -98,3 +103,4 @@ proc renderTimelineTweets*(results: Result[Tweet]; prefs: Prefs; path: string):
renderMore(results.query, results.minId) renderMore(results.query, results.minId)
else: else:
renderNoMore() renderNoMore()
renderToTop()