1 import moment from 'moment';
2 import PropTypes from 'prop-types';
3 import React from 'react';
4 import { useTranslation } from 'react-i18next';
5 import { Link } from 'react-router-dom';
7 import RawHTML from '../common/RawHTML';
10 } from '../../helpers/Event';
13 } from '../../helpers/Technique';
14 import i18n from '../../i18n';
16 const Item = ({ event }) => {
17 const { t } = useTranslation();
19 const style = React.useMemo(() => {
20 if (event && event.corner) {
22 backgroundImage: `url(${event.corner})`,
26 }, [event && event.corner]);
28 return <li className="events-item my-3 p-2 pb-5 border rounded" style={style}>
30 <Link to={getLink(event)}>
31 {(event.description && getTranslation(event.description, 'title', i18n.language))
35 <div className="d-flex align-items-start justify-content-start">
36 {event.start || event.end ?
37 <div className="event-pane">
39 <div><small>{t('events.start')}</small></div>
40 <div className="mb-2">{moment(event.start).format('LL')}</div>
43 <div><small>{t('events.end')}</small></div>
44 <div className="mb-2">{moment(event.end).format('LL')}</div>
51 html={getTranslation(event.description, 'description', i18n.language)}
60 event: PropTypes.shape({
61 corner: PropTypes.string,
62 description: PropTypes.shape({
64 end: PropTypes.string,
66 name: PropTypes.string,
67 start: PropTypes.string,
68 title: PropTypes.string,