From b5bbe278eb833a748c002765456d97a20a5f3629 Mon Sep 17 00:00:00 2001 From: Syed Ali Abbas Zaidi <88369802+Syed-Ali-Abbas-Zaidi@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:01:10 +0500 Subject: [PATCH] [MM-55333] Convert `./components/post_view/floating_timestamp/floating_timestamp.tsx` from Class Component to Function Component (#25401) Co-authored-by: Mattermost Build --- .../floating_timestamp/floating_timestamp.tsx | 60 +++++++++---------- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/webapp/channels/src/components/post_view/floating_timestamp/floating_timestamp.tsx b/webapp/channels/src/components/post_view/floating_timestamp/floating_timestamp.tsx index b1b339b72b..5c33bfd0ee 100644 --- a/webapp/channels/src/components/post_view/floating_timestamp/floating_timestamp.tsx +++ b/webapp/channels/src/components/post_view/floating_timestamp/floating_timestamp.tsx @@ -17,35 +17,33 @@ type Props = { isRhsPost?: boolean; } -export default class FloatingTimestamp extends React.PureComponent { - render() { - const {createAt, isScrolling, isRhsPost, toastPresent} = this.props; - - if (createAt === 0) { - return null; - } - - const classes = classNames('post-list__timestamp', { - scrolling: isScrolling, - rhs: isRhsPost, - toastAdjustment: toastPresent, - }); - - return ( -
-
- - - -
-
- ); +const FloatingTimestamp = ({createAt, isScrolling, isRhsPost, toastPresent}: Props) => { + if (createAt === 0) { + return null; } -} + + const classes = classNames('post-list__timestamp', { + scrolling: isScrolling, + rhs: isRhsPost, + toastAdjustment: toastPresent, + }); + + return ( +
+
+ + + +
+
+ ); +}; + +export default React.memo(FloatingTimestamp);