blob: 192d0b3b56c9031177dede386c6cb49d370940d8 (
plain)
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
44
45
46
47
48
49
50
51
52
|
import React from 'react';
import {
Card,
CardHeader,
CardContent,
CardActions,
Button
} from '@material-ui/core';
import { Event } from '../../types';
interface PropTypes {
event: Event;
}
const EventCard: React.FC<PropTypes> = ({ event }) => {
const {
data: {
name,
date,
participants,
conferenceId,
attendanceId
}
} = event;
return (
<Card variant="outlined">
<CardHeader title={name || 'Event'} subheader={date} />
<CardContent>
{conferenceId && <div> ConferenceID: {conferenceId} </div>}
{attendanceId && <div> AttendanceID: {attendanceId} </div>}
<div>
Participants ({participants?.length || 0} / 3)
<ul>
{participants?.map(username => (
<li> {username} </li>
))}
</ul>
</div>
</CardContent>
{(participants?.length || 0) < 3 && (
<CardActions>
<Button variant="contained" color="primary" size="large">
Join
</Button>
</CardActions>
)}
</Card>
);
};
export default EventCard;
|