From eca13a947beb8d9a63053f831953e032b451a688 Mon Sep 17 00:00:00 2001 From: Thomas Brq <71637888+thomasbrq@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:24:12 +0100 Subject: [PATCH] Convert class to function component (#25769) Co-authored-by: Mattermost Build --- .../components/analytics/statistic_count.tsx | 81 ++++++++++--------- 1 file changed, 44 insertions(+), 37 deletions(-) diff --git a/webapp/channels/src/components/analytics/statistic_count.tsx b/webapp/channels/src/components/analytics/statistic_count.tsx index 75fb6885df..e6c8ce9391 100644 --- a/webapp/channels/src/components/analytics/statistic_count.tsx +++ b/webapp/channels/src/components/analytics/statistic_count.tsx @@ -15,47 +15,54 @@ type Props = { status?: 'warning' | 'error'; } -export default class StatisticCount extends React.PureComponent { - public render(): JSX.Element { - const loading = ( - - ); +const StatisticCount = ({ + title, + icon, + count, + id, + children, + status, +}: Props) => { + const loading = ( + + ); - return ( -
+ return ( +
+
-
- {this.props.title} - -
-
- {typeof this.props.count === 'undefined' || isNaN(this.props.count) ? loading : this.props.count} -
+ {title} + +
+
+ {typeof count === 'undefined' || isNaN(count) ? loading : count}
- {this.props.children}
- ); - } -} + {children} +
+ ); +}; + +export default React.memo(StatisticCount);