From b7529b13e10f283ecf0b26d3c6aee7d12a936a3b Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 8 Aug 2023 23:49:38 +0200 Subject: [PATCH] Adding scroll to the top button #587, fixes #427 --- src/common/config/public/ClientConfig.ts | 15 +++++++++++++++ src/frontend/app/ui/frame/frame.component.css | 14 ++++++++++++++ src/frontend/app/ui/frame/frame.component.html | 13 ++++++++++--- src/frontend/app/ui/frame/frame.component.ts | 14 +++++++++++--- src/frontend/styles.css | 6 +++--- 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/src/common/config/public/ClientConfig.ts b/src/common/config/public/ClientConfig.ts index 9ce70634..839a980f 100644 --- a/src/common/config/public/ClientConfig.ts +++ b/src/common/config/public/ClientConfig.ts @@ -29,6 +29,10 @@ export enum ThemeModes { light = 1, dark, auto } +export enum ScrollUpModes { + never = 1, mobileOnly, always +} + export type TAGS = { client?: true, priority?: ConfigPriority, @@ -739,6 +743,17 @@ export class NavBarConfig { description: $localize`Ratio of the page height, you need to scroll to hide the navigation bar.`, }) NavbarHideDelay: number = 0.15; + + @ConfigProperty({ + tags: { + name: $localize`Show scroll up button`, + priority: ConfigPriority.underTheHood + }, + type: ScrollUpModes, + description: $localize`Set when the floating scroll-up button should be visible.`, + }) + showScrollUpButton: ScrollUpModes = ScrollUpModes.mobileOnly; + } @SubConfigClass({tags: {client: true}, softReadonly: true}) diff --git a/src/frontend/app/ui/frame/frame.component.css b/src/frontend/app/ui/frame/frame.component.css index 78515612..b4b1f9af 100644 --- a/src/frontend/app/ui/frame/frame.component.css +++ b/src/frontend/app/ui/frame/frame.component.css @@ -60,3 +60,17 @@ a.dropdown-item span, button.dropdown-item span, div.dropdown-item span { a.dropdown-item span.badge, button.dropdown-item span.badge { margin-left: -0.8rem; } + +.btn-scroll-up { + position: fixed; + width: 3em; + height: 3em; + right: -3em; + bottom: 3em; + transition: 0.3s right; + z-index: 999; +} + +.show-btn-scroll-up{ + right: 1em; +} diff --git a/src/frontend/app/ui/frame/frame.component.html b/src/frontend/app/ui/frame/frame.component.html index 3107671f..91366a8b 100644 --- a/src/frontend/app/ui/frame/frame.component.html +++ b/src/frontend/app/ui/frame/frame.component.html @@ -7,7 +7,7 @@
- + {{title}}