Skip to content

Commit

Permalink
fixes share buttons on edu content pages (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephiescastle authored Jul 18, 2024
1 parent be8543f commit f0a0305
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
18 changes: 17 additions & 1 deletion packages/vue/src/templates/PageContent/PageContent.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<script lang="ts">
import { defineComponent } from 'vue'
import { useRoute } from 'vue-router'
import { mapStores } from 'pinia'
import { useThemeStore } from '../../store/theme'
import HeroMedia from '@explorer-1/vue/src/components/HeroMedia/HeroMedia.vue'
import NavSecondary from '@explorer-1/vue/src/components/NavSecondary/NavSecondary.vue'
import LayoutHelper from '@explorer-1/vue/src/components/LayoutHelper/LayoutHelper.vue'
import DetailHeadline from '@explorer-1/vue/src/components/DetailHeadline/DetailHeadline.vue'
import BlockImageStandard from '@explorer-1/vue/src/components/BlockImage/BlockImageStandard.vue'
import ShareButtons from '@explorer-1/vue/src/components/ShareButtons/ShareButtons.vue'
import ShareButtonsEdu from '@explorer-1/vue/src/components/ShareButtonsEdu/ShareButtonsEdu.vue'
import BlockStreamfield from '@explorer-1/vue/src/components/BlockStreamfield/BlockStreamfield.vue'
import BlockRelatedLinks from '@explorer-1/vue/src/components/BlockRelatedLinks/BlockRelatedLinks.vue'
import FormContact from '@explorer-1/vue/src/components/FormContact/FormContact.vue'
Expand All @@ -24,6 +28,7 @@ export default defineComponent({
DetailHeadline,
BlockImageStandard,
ShareButtons,
ShareButtonsEdu,
BlockStreamfield,
BlockRelatedLinks,
FormContact,
Expand All @@ -38,6 +43,10 @@ export default defineComponent({
}
},
computed: {
...mapStores(useThemeStore),
isEdu() {
return this.themeStore.theme === 'ThemeEdu'
},
heroInline() {
if (this.data?.heroPosition === 'inline') {
return true
Expand Down Expand Up @@ -92,6 +101,13 @@ export default defineComponent({
:label="data.displayLabel"
:class="{ 'sr-only': hideH1 }"
/>
<ShareButtonsEdu
v-if="isEdu && data?.url"
class="mt-4"
:url="data.url"
:title="data.title"
:image="data.thumbnailImage?.original"
/>
</LayoutHelper>

<!-- inline hero -->
Expand All @@ -114,7 +130,7 @@ export default defineComponent({
class="lg:mb-0 relative mb-8"
>
<ShareButtons
v-if="data.title && data.url"
v-if="data.title && data.url && !isEdu"
:title="data.title"
:url="data.url"
/>
Expand Down
31 changes: 31 additions & 0 deletions packages/vue/src/templates/edu/PageContentEdu.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ContentPageData } from './../PageContent/PageContent.stories.js'
import PageContent from './../PageContent/PageContent.vue'

export default {
title: 'Templates/EDU/PageContent',
component: PageContent,
decorators: [
() => ({
template: `<div id="storyDecorator" class="ThemeEdu"><story/></div>`
})
],
parameters: {
html: {
root: '#storyDecorator'
},
docs: {
description: {
component:
'EDU uses the same `PageContent` component as WWW. The only difference is the theme class used on the site.'
}
}
},
excludeStories: /.*(Data)$/
}

// stories
export const BaseStory = {
args: {
data: ContentPageData
}
}
2 changes: 1 addition & 1 deletion packages/vue/src/templates/edu/PageEduNewsDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const dateTimeArray = computed(() => {
:topics="data.getTopicsForDisplay"
schema
/>
<share-buttons-edu
<ShareButtonsEdu
v-if="data?.url"
class="mt-4"
:url="data.url"
Expand Down

0 comments on commit f0a0305

Please sign in to comment.