Skip to content

Commit

Permalink
fix: adding hero title option to PageContent template (#687)
Browse files Browse the repository at this point in the history
* adding hero title option to PageContent template

* updating storybook data

* lint
  • Loading branch information
stephiescastle authored Nov 6, 2024
1 parent 714aa8f commit 851952a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
16 changes: 14 additions & 2 deletions packages/vue/src/templates/PageContent/PageContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { defineComponent } from 'vue'
import { useRoute } from 'vue-router'
import { mapStores } from 'pinia'
import { useThemeStore } from '../../store/theme'
import HeroLarge from './../../components/HeroLarge/HeroLarge.vue'
import HeroMedia from './../../components/HeroMedia/HeroMedia.vue'
import NavSecondary from './../../components/NavSecondary/NavSecondary.vue'
import LayoutHelper from './../../components/LayoutHelper/LayoutHelper.vue'
Expand All @@ -21,6 +22,7 @@ const route = useRoute()
export default defineComponent({
name: 'PageContent',
components: {
HeroLarge,
HeroMedia,
NavSecondary,
LayoutHelper,
Expand Down Expand Up @@ -54,6 +56,9 @@ export default defineComponent({
}
return false
},
heroTitle() {
return this.data?.heroImage && !this.heroInline && this.data?.displayTitleInHero
},
hideH1() {
if (route?.path === '/a-plan-for-jpl') {
return true
Expand All @@ -77,8 +82,14 @@ export default defineComponent({
:class="{ '-nav-offset': !heroInline && data.heroImage }"
>
<!-- hero image -->
<HeroLarge
v-if="heroTitle"
:title="data.title"
:image="data.heroImage"
:summary="data.heroSummary"
/>
<HeroMedia
v-if="data.heroImage && !heroInline"
v-else-if="!heroTitle && data.heroImage && !heroInline"
class="md:mb-0 mb-10"
:image="data.heroImage"
:caption="data.heroImageCaption"
Expand All @@ -98,13 +109,14 @@ export default defineComponent({
:class="h1LayoutHelperClasses"
>
<DetailHeadline
v-if="!heroTitle"
:title="data.title"
:label="displayLabel"
:class="{ 'sr-only': hideH1 }"
/>
<ShareButtonsEdu
v-if="themeStore.isEdu && data?.url"
class="mt-4"
:class="{ 'mt-4': !heroTitle }"
:url="data.url"
:title="data.title"
:image="data.thumbnailImage?.original"
Expand Down
18 changes: 17 additions & 1 deletion packages/vue/src/templates/edu/PageContentEdu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export default {
export const BaseStory = {
name: 'PageContent',
args: {
data: { ...ContentPageData, displayLabel: undefined, parent: { title: 'Parent Page' } }
data: {
...ContentPageData,
displayLabel: undefined,
parent: { title: 'Parent Page' }
}
}
}
export const HeroTitle = {
args: {
data: {
...ContentPageData,
displayLabel: undefined,
parent: { title: 'Parent Page' },
displayTitleInHero: true,
heroSummary: 'Text appears below the title',
heroPosition: 'full'
}
}
}

0 comments on commit 851952a

Please sign in to comment.