From ace6bfed531e1ac7a4ba39852adfb4712b994074 Mon Sep 17 00:00:00 2001
From: Jess
Date: Thu, 26 Sep 2024 17:28:29 -0700
Subject: [PATCH] feat: Apps-2951 card meta changes for article detail page
(#618)
* feat: card-meta date-created prop
* feat: ftvaArticle styles
* fix: linter, tweaks
* fix: styles based on UX feedback
* fix: add globalstore to story for sharebutton
* fix: mistake in story
---------
Co-authored-by: Jess Divers
---
src/lib-components/CardMeta.vue | 24 +++++++-
src/stories/CardMeta.stories.js | 105 +++++++++++++++++++++++++++++++-
src/styles/ftva/_card-meta.scss | 42 +++++++++++--
3 files changed, 164 insertions(+), 7 deletions(-)
diff --git a/src/lib-components/CardMeta.vue b/src/lib-components/CardMeta.vue
index 4c97772a6..56107bb0e 100644
--- a/src/lib-components/CardMeta.vue
+++ b/src/lib-components/CardMeta.vue
@@ -49,6 +49,12 @@ const props = defineProps({
type: String,
default: '',
},
+ // often used to display date article was published
+ // will be styled or formatted differently than startDate & endDate
+ dateCreated: {
+ type: String,
+ required: false,
+ },
// 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: {
@@ -119,6 +125,13 @@ const parsedDate = computed(() => {
return ''
})
+const parsedDateCreated = computed(() => {
+ if (props.dateCreated)
+ return format(new Date(props.dateCreated), 'MMMM d, yyyy')
+
+ return ''
+})
+
const parsedTime = computed(() => {
// necessary check for library-website-nuxt & meap
if (props.startDate && props.sectionHandle === 'event')
@@ -147,7 +160,7 @@ const parsedLocations = computed(() => {
})
const classes = computed(() => {
- return ['card-meta', theme?.value || '']
+ return ['card-meta', theme?.value || '', props.sectionHandle]
})
@@ -199,6 +212,12 @@ const classes = computed(() => {
class="schedule-item"
v-html="bylineTwo"
/>
+
+ {{ parsedDateCreated }}
+
{
+
+ About the author
+
'ftva'),
+ }
+ },
components: { CardMeta },
template: `
Our guest writer is Jen Diamond. She wrote this entry
',
+ sectionHandle: 'ftvaArticle'
+}
+const parsedArticleCategories = mockFTVAArticleData.articleCategories.map(category => category.title).join(', ')
+// data for share button in slot
+const mockSocialList = {
+ buttonTitle: 'Share',
+ hasIcon: true,
+ dropdownList: [
+ {
+ dropdownItemTitle: 'Copy Link',
+ dropdownItemUrl: '',
+ iconName: 'svg-icon-ftva-social-link',
+ },
+ {
+ dropdownItemTitle: 'Email',
+ dropdownItemUrl: '',
+ iconName: 'svg-icon-ftva-social-email',
+ },
+ {
+ dropdownItemTitle: 'Facebook',
+ dropdownItemUrl: 'https://www.facebook.com/sharer/sharer.php?u=',
+ iconName: 'svg-icon-ftva-social-facebook',
+ },
+ {
+ dropdownItemTitle: 'X',
+ dropdownItemUrl: 'https://twitter.com/share?url=',
+ iconName: 'svg-icon-ftva-social-x',
+ },
+ ],
+}
+export function FTVAArticleDetailWShareButton() {
+ return {
+ data() {
+ return {
+ ...mockFTVAArticleData,
+ parsedArticleCategories,
+ mockSocialList
+ }
+ },
+ provide() {
+ return {
+ theme: computed(() => 'ftva'),
+ }
+ },
+ // The ShareButton needs globalstore logic, so its included in this story
+ setup() {
+ onMounted(() => {
+ const globalStore = useGlobalStore()
+
+ const updateWinWidth = () => {
+ globalStore.winWidth = window.innerWidth
+ }
+
+ updateWinWidth()
+
+ window.addEventListener('resize', updateWinWidth)
+
+ onBeforeUnmount(() => {
+ window.removeEventListener('resize', updateWinWidth)
+ })
+ })
+ },
+ components: { CardMeta, ButtonDropdown },
+ template: `
+
+
+
+ `,
+ }
+}
diff --git a/src/styles/ftva/_card-meta.scss b/src/styles/ftva/_card-meta.scss
index 2f3db1b1a..b7b193903 100644
--- a/src/styles/ftva/_card-meta.scss
+++ b/src/styles/ftva/_card-meta.scss
@@ -4,7 +4,7 @@
.category {
@include ftva-button-link;
color: $accent-blue;
- margin: 0 0 20px;
+ margin: 0 0 12px;
}
.title {
@@ -14,7 +14,7 @@
}
.title-no-link {
- @include ftva-h3;
+ @include ftva-h2;
color: $heading-grey;
margin: 0 0 24px;
}
@@ -28,6 +28,18 @@
margin-bottom: 8px;
}
+ .byline-group {
+ flex-direction: row;
+ @include ftva-body-2;
+ color: $medium-grey;
+ .date-created::before {
+ content: url('ucla-library-design-tokens/assets/svgs/icon-ftva-diamond.svg');
+ margin: 0 8px;
+ padding-top: -10px;
+ filter: invert(98%) sepia(131%) saturate(1029%) hue-rotate(196deg) brightness(130%) contrast(68%);
+ }
+ }
+
// styles the rich-text components
// introduction and guestSpeaker
.rich-text {
@@ -36,15 +48,35 @@
}
.sharebutton-slot {
- margin-top: 28px;
-
+ margin-top: 20px;
+ margin-bottom: 36px;
&:empty {
display: none;
}
+ @media #{$small} {
+ margin-top: 12px;
+ margin-bottom: 28px;
+ }
}
.parsed-start-time {
@include ftva-emphasized-subtitle;
color: $accent-blue;
}
-}
+
+ &.ftvaArticle {
+ // on card-meta with sectionHandle prop = 'ftvaArticle'
+ // we have a unique 'About the Author' section which uses different styles
+ .heading-about-author {
+ @include ftva-subtitle-2;
+ color: $accent-blue;
+ padding-bottom: 4px;
+ }
+ .text {
+ :deep(.parsed-content) > p {
+ @include ftva-body-2;
+ color: $medium-grey;
+ }
+ }
+ }
+}
\ No newline at end of file