Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add helptext to landing hero CTA button #2313

Merged
merged 6 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = function(migration) {
const landingPage = migration
.editContentType('landingPage');

landingPage
.createField('relatedLinkDescription')
.name('CTA Help text')
.type('Text')
.localized(true)
.required(false)
.validations([])
.disabled(false)
.omitted(false);

landingPage.changeFieldControl('relatedLinkDescription', 'builtin', 'markdown', {
helpText: 'Text to accompany the CTA button.'
});

landingPage
.moveField('relatedLinkDescription')
.afterField('relatedLink');
};
27 changes: 27 additions & 0 deletions packages/portal/src/components/landing/LandingHero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
>
{{ cta.text }}
</SmartLink>
<!-- eslint-disable vue/no-v-html -->
<div
v-if="ctaHelpText"
class="btn-cta-helptext form-text text-muted mt-3"
v-html="parseMarkdownHtml(ctaHelpText)"
/>
<!-- eslint-enable vue/no-v-html -->
</header>
</div>
<ImageWithAttribution
Expand Down Expand Up @@ -74,6 +81,10 @@
type: Object,
default: null
},
ctaHelpText: {
type: String,
default: null
},
/**
* Image used as a partial background with attribution.
* Gets a blue overlay
Expand Down Expand Up @@ -179,6 +190,22 @@
p {
color: $mediumgrey;
}

.btn-cta-helptext {

@media (min-width: $bp-4k) {
font-size: $font-size-large;
margin-top: 2rem !important;
}

::v-deep p {
margin-bottom: 0;
}

::v-deep a {
color: $mediumgrey;
}
}
}

.hero-image {
Expand Down
5 changes: 5 additions & 0 deletions packages/portal/src/components/landing/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
:headline="headline"
:text="text"
:cta="cta"
:cta-help-text="ctaHelpText"
:hero-image="primaryImageOfPage"
/>
<div
Expand Down Expand Up @@ -129,6 +130,10 @@
type: Object,
default: null
},
ctaHelpText: {
type: String,
default: null
},
sections: {
type: Array,
default: () => []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ query LandingPage(
url
text
}
relatedLinkDescription
primaryImageOfPage {
...imageWithAttributionFields
}
Expand Down
1 change: 1 addition & 0 deletions packages/portal/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
:headline="page.headline || page.name"
:text="page.text"
:cta="page.relatedLink"
:cta-help-text="page.relatedLinkDescription"
:sections="page.hasPartCollection?.items.filter((item) => !!item)"
:primary-image-of-page="page.primaryImageOfPage"
/>
Expand Down
Loading