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

fix: share buttons on edu content pages #503

Merged
merged 2 commits into from
Jul 18, 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
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
Loading