import React, { useState } from 'react'; import { CalendarEvent } from '../store/calendar.types'; import cx from 'classnames'; import { Menu, Paragraph } from 'app/shared/components/text/text'; import datePipe from 'app/shared/pipes/date.pipe'; export interface Props { event: CalendarEvent; past?: boolean; } const getTimeRange = (startDate: string, endDate: string | null) => { return `${datePipe.getHourFromStringDate(startDate)}${endDate ? '-' + datePipe.getHourFromStringDate(endDate) : ''} (CET)`; }; const CalendarListItem = ({ event, past } : Props) => { const { title, description, date, endDate, fileName, fileUrl } = event; const [ isOnLink, setOnLinkFlag ] = useState(false); const containerClassName = cx('c-calendar-list-item', { 'c-calendar-list-item--past': past }, ); const downloadClassName = cx('c-calendar-list-item__download', { 'c-calendar-list-item__download--past': past }, ); const fileClassName = cx('u-font--clear-spacings', { 'u-color--dark-grey' : past }, ); const titleClassName = cx('u-font--clear-spacings', 'u-margin-bottom--tiny', { 'u-color--dark-grey' : past } ); const dateClassName = cx(' u-uppercase', 'u-margin-top--tiny', 'u-margin-lg-top--none', 'c-calendar-list-item__date-item', { 'c-calendar-list-item__date-item--past': past }, ); const handleLinkEnter = () => { setOnLinkFlag(true); }; const handeLinkLeave = () => { setOnLinkFlag(false); }; return