From ecbf3edf1a704a72e979a087a4bdd17e15767eda Mon Sep 17 00:00:00 2001 From: Jess Date: Tue, 10 Sep 2024 14:21:47 -0700 Subject: [PATCH] feat: APPS-2917 FTVA series date variation (#602) * feat: start stories for cardmeta * fix: run linter * chore: add story, setup * chore: lint * feat: short date ranges on ftvaEventSeries * chore: update story for sectionwrapper * fix: dont show date range if ftvaEvent * chore: lint * fix: apply blue background to element w border radius * chore: remove console log lint --------- Co-authored-by: Jess Divers --- src/lib-components/CardMeta.vue | 22 +++-- src/stories/CardMeta.stories.js | 20 +++++ src/stories/SectionTeaserCard.stories.js | 95 ++++++++++++++++++++- src/stories/SectionWrapper.stories.js | 5 +- src/styles/ftva/_block-card-with-image.scss | 9 +- src/styles/ftva/_section-wrapper.scss | 4 +- src/utils/formatEventDates.js | 6 ++ 7 files changed, 147 insertions(+), 14 deletions(-) diff --git a/src/lib-components/CardMeta.vue b/src/lib-components/CardMeta.vue index 6ae56d0ac..c506b8a56 100644 --- a/src/lib-components/CardMeta.vue +++ b/src/lib-components/CardMeta.vue @@ -48,7 +48,8 @@ const props = defineProps({ type: String, default: '', }, - // long = 'Febuary 1, 2022', short = 'Feb 1, 2022 + // long single date = 'Febuary 1, 2022', short = 'Feb 1, 2022 + // long date range = 'Febuary 1, 2022 - Febuary 2, 2022', short = 'Feb 1 - Feb 2' dateFormat: { type: String, default: 'long', @@ -107,8 +108,13 @@ const parsedTarget = computed(() => { }) const parsedDate = computed(() => { - if (props.startDate) - return props.endDate ? formatDates(props.startDate, props.endDate, props.dateFormat) : formatDates(props.startDate, props.startDate, props.dateFormat) + if (props.startDate) { + if (props.sectionHandle === 'ftvaEvent') + return formatDates(props.startDate, props.startDate, props.dateFormat) + + else + return props.endDate ? formatDates(props.startDate, props.endDate, props.dateFormat) : formatDates(props.startDate, props.startDate, props.dateFormat) + } return '' }) @@ -117,10 +123,10 @@ const parsedTime = computed(() => { if (props.startDate && props.sectionHandle === 'event') return formatTimes(props.startDate, props.endDate) // legacy behavior returns nothing when sectionHandle is not 'event', - // so check theme is set to avoid returning nothing - else if (props.startDate && theme?.value !== undefined) + // so check theme is set AND we are not showing ftvaEventSeries data to avoid returning nothing + else if (props.startDate && (props.sectionHandle !== 'ftvaEventSeries' && theme?.value !== undefined)) return props.endDate ? formatTimes(props.startDate, props.endDate) : formatTimes(props.startDate, props.startDate) - + // in all other cases incl. if it is ftvaEventSeries, return nothing return '' }) @@ -196,7 +202,7 @@ const classes = computed(() => { v-if="startDate || ongoing" class="date-time" > -
+
Ongoing