Convert ./components/post_view/scroll_to_bottom_arrows.tsx to functional component (#24801)
* Convert ./components/post_view/scroll_to_bottom_arrows.tsx from Class Component to Function Component * update scroll_to_bottom_arrows component * enhancement: scroll_to_bottom_arrows component * update scroll_to_bottom_arrows component --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d2d820cb31
Коммит
0bf7f1413c
@@ -1,35 +1,33 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import classNames from 'classnames';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import ScrollToBottomIcon from 'components/widgets/icons/scroll_to_bottom_icon';
|
import ScrollToBottomIcon from 'components/widgets/icons/scroll_to_bottom_icon';
|
||||||
|
|
||||||
interface Props {
|
type Props = {
|
||||||
isScrolling: boolean;
|
isScrolling: boolean;
|
||||||
atBottom?: boolean;
|
atBottom?: boolean;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default class ScrollToBottomArrows extends React.PureComponent<Props> {
|
const ScrollToBottomArrows = ({isScrolling, atBottom, onClick}: Props) => {
|
||||||
render() {
|
// only show on mobile
|
||||||
// only show on mobile
|
if (window.innerWidth > 768) {
|
||||||
if (window.innerWidth > 768) {
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
let className = 'post-list__arrows';
|
|
||||||
if (this.props.isScrolling && this.props.atBottom === false) {
|
|
||||||
className += ' scrolling';
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className={className}
|
|
||||||
onClick={this.props.onClick}
|
|
||||||
>
|
|
||||||
<ScrollToBottomIcon/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames('post-list__arrows', {
|
||||||
|
scrolling: isScrolling && atBottom === false,
|
||||||
|
})}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
<ScrollToBottomIcon/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ScrollToBottomArrows;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user