Use PendingItemsRow for pending members, pass a prop to control its size
This commit is contained in:
parent
f6b28dd9c3
commit
143a9eda44
|
@ -1,3 +1,4 @@
|
||||||
|
import clsx from 'clsx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
@ -9,17 +10,26 @@ interface IPendingItemsRow {
|
||||||
to: string
|
to: string
|
||||||
/** Number of pending items. */
|
/** Number of pending items. */
|
||||||
count: number
|
count: number
|
||||||
|
/** Size of the icon. */
|
||||||
|
size?: 'md' | 'lg'
|
||||||
}
|
}
|
||||||
|
|
||||||
const PendingItemsRow: React.FC<IPendingItemsRow> = ({ to, count }) => {
|
const PendingItemsRow: React.FC<IPendingItemsRow> = ({ to, count, size = 'md' }) => {
|
||||||
return (
|
return (
|
||||||
<Link to={to} className='group'>
|
<Link to={to} className='group'>
|
||||||
<HStack alignItems='center' justifyContent='between'>
|
<HStack alignItems='center' justifyContent='between'>
|
||||||
<HStack alignItems='center' space={2}>
|
<HStack alignItems='center' space={2}>
|
||||||
<div className='rounded-full bg-primary-200 p-3 text-primary-500 dark:bg-primary-800 dark:text-primary-200'>
|
<div className={clsx('rounded-full bg-primary-200 text-primary-500 dark:bg-primary-800 dark:text-primary-200', {
|
||||||
|
'p-3': size === 'lg',
|
||||||
|
'p-2.5': size === 'md',
|
||||||
|
})}
|
||||||
|
>
|
||||||
<Icon
|
<Icon
|
||||||
src={require('@tabler/icons/exclamation-circle.svg')}
|
src={require('@tabler/icons/exclamation-circle.svg')}
|
||||||
className='h-7 w-7'
|
className={clsx({
|
||||||
|
'h-5 w-5': size === 'md',
|
||||||
|
'h-7 w-7': size === 'lg',
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
|
||||||
|
import { PendingItemsRow } from 'soapbox/components/pending-items-row';
|
||||||
import ScrollableList from 'soapbox/components/scrollable-list';
|
import ScrollableList from 'soapbox/components/scrollable-list';
|
||||||
import { useGroup } from 'soapbox/hooks';
|
import { useGroup } from 'soapbox/hooks';
|
||||||
import { useGroupMembershipRequests } from 'soapbox/hooks/api/groups/useGroupMembershipRequests';
|
import { useGroupMembershipRequests } from 'soapbox/hooks/api/groups/useGroupMembershipRequests';
|
||||||
|
@ -47,7 +48,7 @@ const GroupMembers: React.FC<IGroupMembers> = (props) => {
|
||||||
itemClassName='py-3 last:pb-0'
|
itemClassName='py-3 last:pb-0'
|
||||||
>
|
>
|
||||||
{(pending.length > 0) && (
|
{(pending.length > 0) && (
|
||||||
<div>{pending.length} pending members</div>
|
<PendingItemsRow to={`/groups/${groupId}/manage/requests`} count={pending.length} />
|
||||||
)}
|
)}
|
||||||
{members.map((member) => (
|
{members.map((member) => (
|
||||||
<GroupMemberListItem
|
<GroupMemberListItem
|
||||||
|
|
|
@ -20,6 +20,7 @@ export default () => {
|
||||||
data-testid='pending-groups-row'
|
data-testid='pending-groups-row'
|
||||||
to='/groups/pending-requests'
|
to='/groups/pending-requests'
|
||||||
count={groups.length}
|
count={groups.length}
|
||||||
|
size='lg'
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
Loading…
Reference in New Issue