import { Box, Text, Grid, Badge, Flex, Avatar, Heading } from 'theme-ui'
import tt from 'tinytime'
import Link from 'next/link'
import { keyframes } from '@emotion/react'
const past = dt => new Date(dt) < new Date()
const now = (start, end) =>
new Date() > new Date(start) && new Date() < new Date(end)
const Event = ({ id, slug, title, desc, leader, avatar, start, end, cal }) => (
{tt('{MM} {Do}').render(new Date(start))}{' '}
{tt('{h}:{mm}').render(new Date(start))}–
{tt('{h}:{mm} {a}').render(new Date(end))}
{title}
{now(start, end)}
{!avatar.includes('emoji') && (
)}
{leader}
{/* {now(start, end) && (
)} */}
)
const flashing = keyframes({
from: { opacity: 0 },
'50%': { opacity: 1 },
to: { opacity: 0 }
})
function Dot() {
return (
)
}
export default function Events({ events }) {
return (
{events
.slice(0, 3)
.map(event =>
!past(event.end) ? : <>>
)}
)
}