From 9350858e665994535c14e39c68cb14cc7afb6a83 Mon Sep 17 00:00:00 2001 From: Vincent Wilson Date: Thu, 22 Feb 2024 11:23:58 -0500 Subject: [PATCH] Cleanup event rendering --- .../web-shared/components/ContentSingle.js | 117 ++++++++++++++---- 1 file changed, 90 insertions(+), 27 deletions(-) diff --git a/packages/web-shared/components/ContentSingle.js b/packages/web-shared/components/ContentSingle.js index d2744e14..6a6f7ed2 100644 --- a/packages/web-shared/components/ContentSingle.js +++ b/packages/web-shared/components/ContentSingle.js @@ -11,7 +11,17 @@ import FeatureFeedComponentMap from './FeatureFeed/FeatureFeedComponentMap'; import { add as addBreadcrumb, useBreadcrumbDispatch } from '../providers/BreadcrumbProvider'; import { set as setModal, useModal } from '../providers/ModalProvider'; -import { Box, Loader, Longform, H3, ContentCard, BodyText, ShareButton } from '../ui-kit'; +import { + Box, + Loader, + Longform, + H3, + ContentCard, + BodyText, + ShareButton, + Icons, + PhospherIcon, +} from '../ui-kit'; import { useFeatureFeed, useHTMLContent, useVideoMediaProgress } from '../hooks'; import { Title, ParentTitle, ParentSummary } from './ContentSingle.styles'; @@ -19,6 +29,59 @@ import VideoPlayer from './VideoPlayer'; import InteractWhenLoaded from './InteractWhenLoaded'; import TrackEventWhenLoaded from './TrackEventWhenLoaded'; +import styled from 'styled-components'; + +const infoDivider = ( + + | + +); + +const CalendarIconWrapper = styled.span` + margin-right: ${({ theme }) => theme.space.xxs}; + display: inline-block; + @media (min-width: ${({ theme }) => theme.breakpoints.sm}) { + display: none; + } +`; + +const CalendarIcon = ({ name, size }) => ( + + + +); + +const CalendarDataContainer = styled.div` + display: flex; + align-items: center; +`; + +function CalendarData({ start, end, location }) { + return ( + <> + {location ? ( + + + {location} + + ) : null} + {start && location ? infoDivider : null} + {start ? ( + + + {start} + + ) : null} + {end && start ? infoDivider : null} + {end ? ( + + + {end} + + ) : null} + + ); +} function ContentSingle(props = {}) { const navigate = useNavigate(); @@ -120,11 +183,6 @@ function ContentSingle(props = {}) { dispatch(setModal(url)); } }; - const infoDivider = ( - - | - - ); return ( <> @@ -199,33 +257,38 @@ function ContentSingle(props = {}) { }} mb="s" > - + {/* Title */} - {title && !hasChildContent ? {title} : null} - {title && hasChildContent ? {title} : null} - - {parentChannel?.name || props?.data?.location ? ( + + {title ? {title} : null} + {/* Button moves below on mobile views */} + + + + {parentChannel?.name ? ( - {parentChannel?.name || props?.data?.location} + {parentChannel?.name} ) : null} - {formattedStartDate ? infoDivider : null} - {formattedStartDate ? ( - {formattedStartDate} - ) : null} - {formattedStartToEnd ? infoDivider : null} - {formattedStartToEnd ? ( - {formattedStartToEnd} - ) : null} + + - - + + {htmlContent ? (