diff options
author | eug-vs <eug-vs@keemail.me> | 2020-11-15 00:16:27 +0300 |
---|---|---|
committer | eug-vs <eug-vs@keemail.me> | 2020-11-15 00:17:04 +0300 |
commit | d422fc48943cf01891768c34a10f972637e1319b (patch) | |
tree | d5d59c0083f45ae09b5ad51c116e6f878805e7d5 /src/components | |
parent | f96e6174fe90f3d2b1e3016861017cfcc25a6ddc (diff) | |
download | famcs-kit-d422fc48943cf01891768c34a10f972637e1319b.tar.gz |
feat: add EventCard
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/EventCard/EventCard.tsx | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/components/EventCard/EventCard.tsx b/src/components/EventCard/EventCard.tsx new file mode 100644 index 0000000..88984ff --- /dev/null +++ b/src/components/EventCard/EventCard.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import { makeStyles } from '@material-ui/core/styles'; +import { + Card, + CardHeader, + CardContent, + CardActions, + Button +} from '@material-ui/core'; +import { Event } from '../../types'; + +interface PropTypes { + event: Event; +} + +const useStyles = makeStyles(theme => ({ + root: { + margin: theme.spacing(1), + maxWidth: theme.spacing(60) + } +})); + +const EventCard: React.FC<PropTypes> = ({ event }) => { + const classes = useStyles(); + const { data: { + name, + date, + participants, + conferenceId, + attendanceId + }} = event; + + return ( + <Card variant="outlined" className={classes.root}> + <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; |