import router from 'next/router'; import { styled } from '@mui/material/styles'; import Card from '@mui/material/Card'; import CardActions from '@mui/material/CardActions'; import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import Button from '@mui/material/Button'; import {useTranslation} from 'react-i18next'; import {EventEntity} from '../../generated/graphql'; const PREFIX = 'EventCard'; const classes = { clickable: `${PREFIX}-clickable`, name: `${PREFIX}-name` }; const StyledCard = styled(Card)({ [`&.${classes.clickable}`]: { cursor: 'pointer', }, [`& .${classes.name}`]: { whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', }, }); interface Props { event: EventEntity; } const EventCard = ({event}: Props) => { const {t} = useTranslation(); return ( router.push(`/e/${event.attributes.uuid}`, undefined, {shallow: true}) } > {event.attributes.name} {t('event.fields.date')} {event.attributes.date || t('event.fields.empty')} {t('event.fields.address')} {event.attributes.address || t('event.fields.empty')} ); }; export default EventCard;