forked from orodrigogo/nlwcopa-mobile-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParticipants.tsx
43 lines (39 loc) · 1 KB
/
Participants.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Avatar, Center, HStack, Text } from 'native-base';
export interface ParticipantProps {
id: string;
user: {
name: string;
avatarUrl: string;
};
};
interface Props {
participants: ParticipantProps[];
count: number;
};
export function Participants({participants, count }: Props) {
return (
<HStack>
{
participants && participants.map((participant) => (
<Avatar
key={participant.id}
source={{ uri: participant.user.avatarUrl}}
w={8}
h={8}
rounded="full"
borderWidth={2}
marginRight={-3}
borderColor="gray.800"
>
{participant.user?.name?.at(0).toUpperCase()}
</Avatar>
))
}
<Center w={8} h={8} bgColor="gray.700" rounded="full" borderWidth={1} borderColor="gray.800">
<Text color="gray.100" fontSize="xs" fontFamily="medium">
{count ? `+${count}` : 0}
</Text>
</Center>
</HStack>
);
}