From e87386a0cf5b5f6b35fb5da9b06e6f7a44af3934 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Fri, 15 May 2020 16:31:38 -0400 Subject: [PATCH] Added scroll to top on TimelineQueueButtonHeader click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - scroll to top on TimelineQueueButtonHeader click using utils/scroll_to --- .../components/timeline_queue_button_header.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/javascript/gabsocial/components/timeline_queue_button_header.js b/app/javascript/gabsocial/components/timeline_queue_button_header.js index 9a06a71e..df5b9e9e 100644 --- a/app/javascript/gabsocial/components/timeline_queue_button_header.js +++ b/app/javascript/gabsocial/components/timeline_queue_button_header.js @@ -1,6 +1,7 @@ import { FormattedMessage } from 'react-intl' import classNames from 'classnames/bind' import { shortNumberFormat } from '../utils/numbers' +import { scrollTo } from '../utils/scroll_to' import Button from './button' import Text from './text' @@ -20,8 +21,14 @@ export default class TimelineQueueButtonHeader extends PureComponent { itemType: 'item', } - render () { - const { count, itemType, onClick } = this.props + handleOnClick = () => { + scrollTo(document.documentElement, 0, 500) + + this.props.onClick() + } + + render() { + const { count, itemType } = this.props const hasItems = count > 0 @@ -38,7 +45,7 @@ export default class TimelineQueueButtonHeader extends PureComponent { isNarrow color='white' backgroundColor='brand' - onClick={onClick} + onClick={this.handleOnClick} > { hasItems &&