From f6b28dd9c3ff621454210a47eb567bf3cc92d0ba Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 20 Mar 2023 16:09:19 -0500 Subject: [PATCH] Abstract PendingItemsRow into its own component --- app/soapbox/components/pending-items-row.tsx | 44 +++++++++++++++++++ .../groups/components/pending-groups-row.tsx | 35 +++------------ 2 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 app/soapbox/components/pending-items-row.tsx diff --git a/app/soapbox/components/pending-items-row.tsx b/app/soapbox/components/pending-items-row.tsx new file mode 100644 index 000000000..04ff99d04 --- /dev/null +++ b/app/soapbox/components/pending-items-row.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { FormattedMessage } from 'react-intl'; +import { Link } from 'react-router-dom'; + +import { HStack, Icon, Text } from 'soapbox/components/ui'; + +interface IPendingItemsRow { + /** Path to navigate the user when clicked. */ + to: string + /** Number of pending items. */ + count: number +} + +const PendingItemsRow: React.FC = ({ to, count }) => { + return ( + + + +
+ +
+ + + + +
+ + +
+ + ); +}; + +export { PendingItemsRow }; \ No newline at end of file diff --git a/app/soapbox/features/groups/components/pending-groups-row.tsx b/app/soapbox/features/groups/components/pending-groups-row.tsx index c574b30aa..b57b4691c 100644 --- a/app/soapbox/features/groups/components/pending-groups-row.tsx +++ b/app/soapbox/features/groups/components/pending-groups-row.tsx @@ -1,8 +1,7 @@ import React from 'react'; -import { FormattedMessage } from 'react-intl'; -import { Link } from 'react-router-dom'; -import { Divider, HStack, Icon, Text } from 'soapbox/components/ui'; +import { PendingItemsRow } from 'soapbox/components/pending-items-row'; +import { Divider } from 'soapbox/components/ui'; import { useFeatures } from 'soapbox/hooks'; import { usePendingGroups } from 'soapbox/queries/groups'; @@ -17,31 +16,11 @@ export default () => { return ( <> - - - -
- -
- - - - -
- - -
- +