From 3a5965782ba8e4a327f822ec23abe9683ebf23ef Mon Sep 17 00:00:00 2001 From: Freeplay Date: Mon, 12 Jun 2023 14:59:54 -0400 Subject: [PATCH] widgets scrollbar + little refactor --- packages/client/src/scripts/sticky-sidebar.ts | 59 ------------------- packages/client/src/style.scss | 7 +++ packages/client/src/ui/universal.vue | 33 +++++------ 3 files changed, 22 insertions(+), 77 deletions(-) delete mode 100644 packages/client/src/scripts/sticky-sidebar.ts diff --git a/packages/client/src/scripts/sticky-sidebar.ts b/packages/client/src/scripts/sticky-sidebar.ts deleted file mode 100644 index 61d39173c..000000000 --- a/packages/client/src/scripts/sticky-sidebar.ts +++ /dev/null @@ -1,59 +0,0 @@ -export class StickySidebar { - private lastScrollTop = 0; - private container: HTMLElement; - private el: HTMLElement; - private isTop = false; - private isBottom = false; - private offsetTop: number; - - constructor( - container: StickySidebar["container"], - ) { - this.container = container; - this.container.style.display = "flex"; - this.el = this.container.children[0] as HTMLElement; - this.el.style.position = "sticky"; - this.offsetTop = this.container.getBoundingClientRect().top; - } - - public calc(scrollTop: number) { - if (scrollTop > this.lastScrollTop) { - // downscroll - this.isTop = false; - this.isBottom = - scrollTop + window.innerHeight > - this.el.offsetTop + this.el.clientHeight; - } else { - // upscroll - this.isBottom = false; - this.isTop = scrollTop < this.el.offsetTop + 1; - } - - if (this.isTop) { - if (this.el.style.alignSelf != "flex-start") { - this.el.style.position = "sticky"; - this.el.style.bottom = null; - this.el.style.top = "0px"; - this.el.style.alignSelf = "flex-start"; - console.log("top"); - } - this.offsetTop = scrollTop; - } else if (this.isBottom) { - if (this.el.style.alignSelf != "flex-end") { - this.el.style.position = "sticky"; - this.el.style.bottom = "0px"; - this.el.style.top = null; - this.el.style.alignSelf = "flex-end"; - console.log("bottom"); - } - this.offsetTop = window.innerHeight + scrollTop - this.el.scrollHeight; - } else { - this.el.style.position = "relative"; - this.el.style.top = this.offsetTop + "px"; - this.el.style.bottom = null; - this.el.style.alignSelf = null; - } - - this.lastScrollTop = scrollTop <= 0 ? 0 : scrollTop; - } -} diff --git a/packages/client/src/style.scss b/packages/client/src/style.scss index 8d1141773..6e6a1daec 100644 --- a/packages/client/src/style.scss +++ b/packages/client/src/style.scss @@ -101,6 +101,13 @@ body::-webkit-scrollbar-thumb { } } +.hide-scrollbar { + scrollbar-width: none; + &::-webkit-scrollbar { + display: none; + } +} + html._themeChanging_ { &, *, ::before, ::after { transition: background 1s ease, border 1s ease !important; diff --git a/packages/client/src/ui/universal.vue b/packages/client/src/ui/universal.vue index a027cbdd0..13dd8d4fa 100644 --- a/packages/client/src/ui/universal.vue +++ b/packages/client/src/ui/universal.vue @@ -3,7 +3,7 @@ class="dkgtipfy" :class="{ wallpaper, isMobile, centered: ui === 'classic' }" > - +