From 0bf7f1413c02b9293dedeba8239820815278ca83 Mon Sep 17 00:00:00 2001 From: Kritik Jiyaviya Date: Wed, 18 Oct 2023 13:22:34 +0530 Subject: [PATCH] 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 --- .../post_view/scroll_to_bottom_arrows.tsx | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/webapp/channels/src/components/post_view/scroll_to_bottom_arrows.tsx b/webapp/channels/src/components/post_view/scroll_to_bottom_arrows.tsx index abd6b0defc..8df00dd452 100644 --- a/webapp/channels/src/components/post_view/scroll_to_bottom_arrows.tsx +++ b/webapp/channels/src/components/post_view/scroll_to_bottom_arrows.tsx @@ -1,35 +1,33 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. +import classNames from 'classnames'; import React from 'react'; import ScrollToBottomIcon from 'components/widgets/icons/scroll_to_bottom_icon'; -interface Props { +type Props = { isScrolling: boolean; atBottom?: boolean; onClick: () => void; -} +}; -export default class ScrollToBottomArrows extends React.PureComponent { - render() { - // only show on mobile - if (window.innerWidth > 768) { - return null; - } - - let className = 'post-list__arrows'; - if (this.props.isScrolling && this.props.atBottom === false) { - className += ' scrolling'; - } - - return ( -
- -
- ); +const ScrollToBottomArrows = ({isScrolling, atBottom, onClick}: Props) => { + // only show on mobile + if (window.innerWidth > 768) { + return null; } -} + + return ( +
+ +
+ ); +}; + +export default ScrollToBottomArrows;