Skip to content

Commit

Permalink
fix: APPS-3158 update block card with image (#681)
Browse files Browse the repository at this point in the history
* add conditional to CBlockCardWithImage for custom title & description

* revert changes

* src/stories/BlockCardWithImage.stories.js

* update the css

* remove styles from cardMeta css block

* linting

* move all custom title & description styles to cardMeta component

* move all custom title & description styles to cardMeta component

* linting

* last move

* add comment for a TODO
  • Loading branch information
jendiamond authored Jan 31, 2025
1 parent b8d0f63 commit cb20111
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 19 deletions.
25 changes: 9 additions & 16 deletions src/stories/BlockCardWithImage.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const FTVACustomTitleDescription = TemplateFTVACustomTitleDescription.bin

const mockArticles = [
{
title: '<h3><em>Preserving In Transit:</em> The Chinese in California</h3>',
ftvaAlternativeTitle: '<h3><em>Preserving In Transit:</em> The Chinese in California</h3>',
articleCategories: [
{
title: 'Interview'
Expand Down Expand Up @@ -218,7 +218,7 @@ const mockArticles = [
]
},
{
title: '<h3>From McKinley to LBJ: Presidents in the Hearst Newsreels</h3>',
ftvaAlternativeTitle: '<h3>From McKinley to LBJ: Presidents in the Hearst Newsreels</h3>',
articleCategories: [
{
title: 'Newsreels'
Expand Down Expand Up @@ -247,7 +247,7 @@ const mockArticles = [
]
},
{
title: '<h3>The Effervescent Artist, Educator and Activist Betty Chen</h3>',
ftvaAlternativeTitle: '<h3>The Effervescent Artist, Educator and Activist Betty Chen</h3>',
articleCategories: [
{
title: 'Educators'
Expand Down Expand Up @@ -308,13 +308,12 @@ function TemplateFTVAArticleBlogListing(args) {
category="Interview, People"
:dateCreated="mockArticles[0].postDate"
>
<template #customTitle>
<rich-text v-html="mockArticles[0].title" />
<RichText :rich-text-content="mockArticles[0].ftvaAlternativeTitle" />
</template>
<template #customDescription>
<rich-text v-html="mockArticles[0].ftvaHomepageDescription" />
<RichText :rich-text-content="mockArticles[0].ftvaHomepageDescription" />
</template>
</block-card-with-image>
Expand All @@ -336,14 +335,12 @@ function TemplateFTVAArticleBlogListing(args) {
category="Interview, People"
:dateCreated="mockArticles[1].postDate"
>
<template #customTitle>
<rich-text v-html="mockArticles[1].title" />
<RichText :rich-text-content="mockArticles[1].ftvaAlternativeTitle" />
</template>
<template #customDescription>
<rich-text v-html="mockArticles[1].ftvaHomepageDescription" />
<RichText :rich-text-content="mockArticles[1].ftvaHomepageDescription" />
</template>
</block-card-with-image>
Expand All @@ -356,19 +353,15 @@ function TemplateFTVAArticleBlogListing(args) {
category="Interview, People"
:dateCreated="mockArticles[2].postDate"
>
<template #customTitle>
<rich-text v-html="mockArticles[2].title" />
<RichText :rich-text-content="mockArticles[2].ftvaAlternativeTitle" />
</template>
<template #customDescription>
<rich-text v-html="mockArticles[2].ftvaHomepageDescription" />
<RichText :rich-text-content="mockArticles[2].ftvaHomepageDescription" />
</template>
</block-card-with-image>
</div>
<section-wrapper>
</section-wrapper>
</section-wrapper>
`,
}
Expand Down
8 changes: 6 additions & 2 deletions src/styles/ftva/_block-card-with-image.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// TODO refactor this component to get rid of position absolute for the date/byline

.ftva.block-highlight {
position: relative;

Expand Down Expand Up @@ -88,13 +90,15 @@
}
}

// because right now the byline position is set to absolute
// we need to add this margin to push the date down
:deep(.custom-description) {
.rich-text {
padding-bottom: 24px;
margin-bottom: 48px;
}
}

/* This keeps the moleule image from expanding vertically when in tablet size */
/* This keeps the molecule image from expanding vertically when in tablet size */
&.is-vertical {
flex-direction: column;

Expand Down
14 changes: 13 additions & 1 deletion src/styles/ftva/_card-meta.scss
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,19 @@
.custom-title {
:deep(.rich-text) {
max-width: none;
padding-right: 30px;
margin: 0;

.parsed-content {
margin-bottom: 18px;
}

h3 {
padding-bottom: 0;
margin-top: 0;
margin-bottom: 0;
}

div {
@include ftva-h3;
}
Expand All @@ -67,8 +78,9 @@
.custom-description {
:deep(.rich-text) {
max-width: none;
padding-bottom: 1px;
padding-right: 30px;
margin: 0;
margin-bottom: 48px;

div {
p {
Expand Down

1 comment on commit cb20111

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.