({
placeholderAmount,
scrollingProps,
users,
additionalContent,
afterContent,
initialItem,
isLoading,
emptyPlaceholder,
userInfoProps = {},
}: UserListProps)
| 26 | } |
| 27 | |
| 28 | function UserList({ |
| 29 | placeholderAmount, |
| 30 | scrollingProps, |
| 31 | users, |
| 32 | additionalContent, |
| 33 | afterContent, |
| 34 | initialItem, |
| 35 | isLoading, |
| 36 | emptyPlaceholder, |
| 37 | userInfoProps = {}, |
| 38 | }: UserListProps): ReactElement { |
| 39 | const loader = ( |
| 40 | <UserShortInfoPlaceholder placeholderAmount={placeholderAmount ?? 0} /> |
| 41 | ); |
| 42 | |
| 43 | if (users?.length) { |
| 44 | return ( |
| 45 | <InfiniteScrolling |
| 46 | {...scrollingProps} |
| 47 | aria-label="users-list" |
| 48 | placeholder={loader} |
| 49 | > |
| 50 | {!!initialItem && initialItem} |
| 51 | {users.map((user, i) => ( |
| 52 | <div |
| 53 | className="relative px-4 py-3 hover:bg-surface-hover tablet:px-6" |
| 54 | key={user.username} |
| 55 | > |
| 56 | <Link href={user.permalink}> |
| 57 | <a |
| 58 | className="absolute inset-0 z-0" |
| 59 | rel={anchorDefaultRel} |
| 60 | target="_blank" |
| 61 | aria-label={`View ${user.username}`} |
| 62 | /> |
| 63 | </Link> |
| 64 | <UserShortInfo |
| 65 | {...userInfoProps} |
| 66 | className={{ container: '' }} |
| 67 | tag="div" |
| 68 | user={user} |
| 69 | afterContent={afterContent?.(user, i)} |
| 70 | > |
| 71 | {additionalContent?.(user, i)} |
| 72 | </UserShortInfo> |
| 73 | </div> |
| 74 | ))} |
| 75 | </InfiniteScrolling> |
| 76 | ); |
| 77 | } |
| 78 | |
| 79 | if (isLoading) { |
| 80 | return loader; |
| 81 | } |
| 82 | |
| 83 | return emptyPlaceholder ?? loader; |
| 84 | } |
| 85 |
nothing calls this directly
no outgoing calls
no test coverage detected