From 10fbde2bc778ef01ad4fde0fe3b3b14de9b4e468 Mon Sep 17 00:00:00 2001 From: morethanwords Date: Tue, 12 Jan 2021 13:46:57 +0400 Subject: [PATCH] Two buttons as a row in popup Fix hiding scroll down button while jumping --- src/components/chat/bubbles.ts | 2 +- src/components/popups/index.ts | 4 ++++ src/scss/partials/popups/_popup.scss | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts index 69f2ff7c..d297f135 100644 --- a/src/components/chat/bubbles.ts +++ b/src/components/chat/bubbles.ts @@ -889,7 +889,7 @@ export default class ChatBubbles { }, 1350); } - if(this.scrollable.isScrolledDown) { + if(this.scrollable.isScrolledDown && this.scrolledAllDown) { this.bubblesContainer.classList.add('scrolled-down'); this.scrolledDown = true; } else if(this.bubblesContainer.classList.contains('scrolled-down')) { diff --git a/src/components/popups/index.ts b/src/components/popups/index.ts index 9c49bdbd..d62da30d 100644 --- a/src/components/popups/index.ts +++ b/src/components/popups/index.ts @@ -65,6 +65,10 @@ export default class PopupElement { if(buttons && buttons.length) { const buttonsDiv = document.createElement('div'); buttonsDiv.classList.add('popup-buttons'); + + if(buttons.length === 2) { + buttonsDiv.classList.add('popup-buttons-row'); + } const buttonsElements = buttons.map(b => { const button = document.createElement('button'); diff --git a/src/scss/partials/popups/_popup.scss b/src/scss/partials/popups/_popup.scss index 07504808..72ba9e95 100644 --- a/src/scss/partials/popups/_popup.scss +++ b/src/scss/partials/popups/_popup.scss @@ -97,7 +97,19 @@ display: flex; flex-direction: column; justify-content: flex-end; - align-items: flex-end; + align-items: flex-end; + + &-row { + flex-direction: row-reverse; + justify-content: flex-start; + + .btn { + & + .btn { + margin-top: 0 !important; + margin-right: .5rem; + } + } + } .btn { background: none;