forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scroll_to_bottom_arrows.jsx
37 lines (31 loc) · 1000 Bytes
/
scroll_to_bottom_arrows.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import $ from 'jquery';
import PropTypes from 'prop-types';
import React from 'react';
import ScrollToBottomIcon from 'components/svg/scroll_to_bottom_icon';
export default class ScrollToBottomArrows extends React.PureComponent {
static propTypes = {
isScrolling: PropTypes.bool.isRequired,
atBottom: PropTypes.bool.isRequired,
onClick: PropTypes.func.isRequired,
};
render() {
// only show on mobile
if ($(window).width() > 768) {
return null;
}
let className = 'post-list__arrows';
if (this.props.isScrolling && !this.props.atBottom) {
className += ' scrolling';
}
return (
<div
className={className}
onClick={this.props.onClick}
>
<ScrollToBottomIcon/>
</div>
);
}
}