import styled from 'styled-components'; import { motion } from 'framer-motion'; import { Flex, Text } from '../../../general'; import { BlockProps, Block } from '../Block/Block'; import { FragmentReactionType } from '../Bubble/Bubble.types'; import { Reactions, OnReactionPayload } from '../Bubble/Reaction'; import { timelineDate } from '../../util/date'; export const MemeStyle = styled(motion.img)` width: 100%; max-width: 25rem; border-radius: 4px; margin-bottom: 0.1rem; `; export const FadedText = styled(Text.Custom)` font-size: 0.89rem; opacity: 0.6; `; type MemeBlockProps = { image: string; by: string; date: string; reactions?: FragmentReactionType[]; onReaction: (payload: OnReactionPayload) => void; } & BlockProps; export const MemeBlock = ({ image, by, date, reactions = [], onLoaded, onReaction, ...rest }: MemeBlockProps) => { const dateDisplay = timelineDate(new Date(date)); return ( { onLoaded && onLoaded(); }} draggable={false} /> {by} {dateDisplay} ); };