@explorer-1/vue 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,192 @@
1
+ import { HeroMediaData } from './../../../components/HeroMedia/HeroMedia.stories'
2
+ import { BlockIframeEmbedData } from './../../../components/BlockIframeEmbed/BlockIframeEmbed.stories.js'
3
+ import { BlockImageCarouselData } from './../../../components/BlockImageCarousel/BlockImageCarousel.stories'
4
+ import { BlockImageComparisonData } from './../../../components/BlockImageComparison/BlockImageComparison.stories'
5
+ import { BaseVideoData } from './../../../components/BaseVideo/BaseVideo.stories'
6
+ import { BlockVideoEmbedData } from './../../../components/BlockVideoEmbed/BlockVideoEmbed.stories'
7
+
8
+ import { BlockRelatedLinksData } from './../../../components/BlockRelatedLinks/BlockRelatedLinks.stories.js'
9
+ import { BlockLinkCardCarouselData } from './../../../components/BlockLinkCarousel/BlockLinkCarousel.stories.js'
10
+ import { BlockStreamfieldTruncatedData } from './../../../components/BlockStreamfield/BlockStreamfield.stories'
11
+ import PageEduResourceArticle from './PageEduResourceArticle.vue'
12
+
13
+ export default {
14
+ title: 'Templates/EDU/PageEduResourceArticle',
15
+ component: PageEduResourceArticle,
16
+ decorators: [
17
+ () => ({
18
+ template: `<div id="storyDecorator" class="disable-nav-offset"><story/></div>`
19
+ })
20
+ ],
21
+ parameters: {
22
+ html: {
23
+ root: '#storyDecorator'
24
+ }
25
+ },
26
+ excludeStories: /.*Data$/
27
+ }
28
+
29
+ export const BaseStory = {
30
+ args: {
31
+ data: {
32
+ __typename: 'EDUResourceArticlePage',
33
+ pageType: 'EDUResourceArticlePage',
34
+ contentType: 'edu_resources.EDUResourceArticlePage',
35
+ seoTitle: 'Test Resource',
36
+ searchDescription: '',
37
+ slug: 'test-resource',
38
+ url: 'http://localhost:3000/edu/resources/test-resource',
39
+ title: 'Test Resource',
40
+ heroConstrain: true,
41
+ heroPosition: 'full_bleed',
42
+ hero: [
43
+ {
44
+ ...HeroMediaData,
45
+ blockType: 'HeroImageBlock'
46
+ }
47
+ ],
48
+ ...BlockStreamfieldTruncatedData,
49
+ publicationDate: '2024-07-09',
50
+ summary: 'Summary of resource article',
51
+ getTopicsForDisplay: [
52
+ {
53
+ __typename: 'TopicPage',
54
+ title: 'Asteroids',
55
+ url: 'http://localhost:3000/topics/asteroids'
56
+ }
57
+ ],
58
+ topicLabel: 'Asteroids',
59
+ primarySubject: {
60
+ __typename: 'EDUPrimarySubject',
61
+ id: '2',
62
+ subject: 'Engineering'
63
+ },
64
+ additionalSubjects: [
65
+ {
66
+ __typename: 'EDUPrimarySubject',
67
+ id: '1',
68
+ subject: 'Art'
69
+ }
70
+ ],
71
+ gradeLevels: [
72
+ {
73
+ __typename: 'EDUGradeLevel',
74
+ id: '2',
75
+ gradeLevel: 'K'
76
+ },
77
+ {
78
+ __typename: 'EDUGradeLevel',
79
+ id: '3',
80
+ gradeLevel: '1'
81
+ },
82
+ {
83
+ __typename: 'EDUGradeLevel',
84
+ id: '4',
85
+ gradeLevel: '2'
86
+ },
87
+ {
88
+ __typename: 'EDUGradeLevel',
89
+ id: '13',
90
+ gradeLevel: '11'
91
+ }
92
+ ],
93
+ body: BlockStreamfieldTruncatedData.body,
94
+ thumbnailImage: {
95
+ __typename: 'CustomImage',
96
+ original: 'http://127.0.0.1:9000/media/original_images/imagessirtfsirtf-090303-16.jpg',
97
+ alt: ''
98
+ },
99
+ relatedLinks: BlockRelatedLinksData.data,
100
+ relatedContentHeading: 'Related Content',
101
+ relatedContent: BlockLinkCardCarouselData
102
+ }
103
+ }
104
+ }
105
+ export const InlineHero = {
106
+ args: {
107
+ data: {
108
+ ...BaseStory.args.data,
109
+ heroPosition: 'inline'
110
+ }
111
+ }
112
+ }
113
+
114
+ export const HeroCarousel = {
115
+ args: {
116
+ data: {
117
+ ...BaseStory.args.data,
118
+ hero: [{ blockType: 'CarouselBlock', blocks: BlockImageCarouselData }]
119
+ }
120
+ }
121
+ }
122
+
123
+ export const HeroImageComparison = {
124
+ args: {
125
+ data: {
126
+ ...BaseStory.args.data,
127
+ heroPosition: 'inline',
128
+ hero: [
129
+ {
130
+ ...BlockImageComparisonData
131
+ }
132
+ ]
133
+ }
134
+ }
135
+ }
136
+
137
+ export const HeroVideo = {
138
+ args: {
139
+ data: {
140
+ ...BaseStory.args.data,
141
+ hero: [
142
+ {
143
+ blockType: 'VideoBlock',
144
+ video: BaseVideoData,
145
+ caption: 'Lorem ipsum dolor sit amet',
146
+ credit: 'NASA/JPL'
147
+ }
148
+ ]
149
+ }
150
+ }
151
+ }
152
+
153
+ export const HeroVideoEmbed = {
154
+ args: {
155
+ data: {
156
+ ...BaseStory.args.data,
157
+ heroPosition: 'inline',
158
+ hero: [
159
+ {
160
+ ...BlockVideoEmbedData.data,
161
+ embed: {
162
+ embed: `<iframe title="Meet NASA's Diana Trujillo - Embedded Hero" width="480" height="270" src="https://www.youtube.com/embed/vUuUyYqI83Q?feature=oembed" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`
163
+ },
164
+ blockType: 'VideoEmbedBlock'
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ }
170
+
171
+ export const HeroIframeEmbed = {
172
+ args: {
173
+ data: {
174
+ ...BaseStory.args.data,
175
+ heroPosition: 'inline',
176
+ hero: [
177
+ {
178
+ ...BlockIframeEmbedData
179
+ }
180
+ ]
181
+ }
182
+ }
183
+ }
184
+
185
+ export const NoHero = {
186
+ args: {
187
+ data: {
188
+ ...BaseStory.args.data,
189
+ hero: []
190
+ }
191
+ }
192
+ }
@@ -0,0 +1,196 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue'
3
+ import HeroMedia from './../../../components/HeroMedia/HeroMedia.vue'
4
+ import BaseImagePlaceholder from './../../../components/BaseImagePlaceholder/BaseImagePlaceholder.vue'
5
+ import BlockImageCarousel from './../../../components/BlockImageCarousel/BlockImageCarousel.vue'
6
+ import BlockImageComparison from './../../../components/BlockImageComparison/BlockImageComparison.vue'
7
+ import BlockLinkCarousel from './../../../components/BlockLinkCarousel/BlockLinkCarousel.vue'
8
+ import LayoutHelper from './../../../components/LayoutHelper/LayoutHelper.vue'
9
+ import DetailHeadline from './../../../components/DetailHeadline/DetailHeadline.vue'
10
+ import BlockImageStandard from './../../../components/BlockImage/BlockImageStandard.vue'
11
+ import ShareButtonsEdu from './../../../components/ShareButtonsEdu/ShareButtonsEdu.vue'
12
+ import BlockStreamfield from './../../../components/BlockStreamfield/BlockStreamfield.vue'
13
+ import BlockIframeEmbed from '../../../components/BlockIframeEmbed/BlockIframeEmbed.vue'
14
+ import BlockRelatedLinks from '../../../components/BlockRelatedLinks/BlockRelatedLinks.vue'
15
+
16
+ export default defineComponent({
17
+ name: 'PageEduResourceArticle',
18
+ components: {
19
+ HeroMedia,
20
+ BaseImagePlaceholder,
21
+ LayoutHelper,
22
+ DetailHeadline,
23
+ BlockImageStandard,
24
+ BlockIframeEmbed,
25
+ ShareButtonsEdu,
26
+ BlockStreamfield,
27
+ BlockImageCarousel,
28
+ BlockImageComparison,
29
+ BlockLinkCarousel,
30
+ BlockRelatedLinks
31
+ },
32
+ props: {
33
+ data: {
34
+ type: Object,
35
+ required: false,
36
+ default: undefined
37
+ }
38
+ },
39
+ computed: {
40
+ heroEmpty(): boolean {
41
+ return (this.data?.hero || []).length === 0
42
+ },
43
+ heroInline(): boolean {
44
+ if (!this.heroEmpty) {
45
+ if (this.data?.hero[0].blockType === 'VideoBlock') {
46
+ return false
47
+ } else if (
48
+ this.data?.heroPosition === 'inline' ||
49
+ this.data?.hero[0].blockType === 'CarouselBlock'
50
+ ) {
51
+ return true
52
+ }
53
+ }
54
+ return false
55
+ },
56
+ computedClass(): string {
57
+ if (this.heroInline || this.heroEmpty) {
58
+ return 'pt-5 lg:pt-12'
59
+ } else if (!this.heroInline) {
60
+ return '-nav-offset'
61
+ }
62
+ return ''
63
+ }
64
+ }
65
+ })
66
+ </script>
67
+ <template>
68
+ <div
69
+ v-if="data"
70
+ class="ThemeVariantLight"
71
+ :class="computedClass"
72
+ itemscope
73
+ itemtype="http://schema.org/Article"
74
+ >
75
+ <!-- schema.org -->
76
+ <meta
77
+ v-if="data.thumbnailImage && data.thumbnailImage.original"
78
+ itemprop="image"
79
+ :content="data.thumbnailImage.original"
80
+ />
81
+
82
+ <!-- hero image -->
83
+ <HeroMedia
84
+ v-if="
85
+ !heroEmpty &&
86
+ !heroInline &&
87
+ (data.hero[0].blockType === 'HeroImageBlock' || data.hero[0].blockType === 'VideoBlock')
88
+ "
89
+ class="md:mb-12 lg:mb-18 mb-10"
90
+ :image="data.hero[0].image"
91
+ :video="data.hero[0].video"
92
+ :display-caption="data.hero[0].displayCaption"
93
+ :caption="data.hero[0].caption"
94
+ :credit="data.hero[0].credit"
95
+ :constrain="data.heroConstrain"
96
+ />
97
+
98
+ <!-- news headline and author -->
99
+ <LayoutHelper
100
+ indent="col-2"
101
+ class="mb-10"
102
+ >
103
+ <DetailHeadline
104
+ :title="data.title"
105
+ :publication-date="data.publicationDate"
106
+ :publication-time="data.publicationTime"
107
+ :author="data.author"
108
+ :label="data.displayLabel"
109
+ schema
110
+ />
111
+ <share-buttons-edu
112
+ v-if="data?.url"
113
+ class="mt-4"
114
+ :url="data.url"
115
+ :title="data.title"
116
+ :image="data.thumbnailImage?.original"
117
+ />
118
+ </LayoutHelper>
119
+
120
+ <!-- inline hero content -->
121
+ <LayoutHelper
122
+ v-if="!heroEmpty && heroInline"
123
+ indent="col-2"
124
+ class="lg:mb-22 mt-10 mb-10"
125
+ >
126
+ <BlockImageStandard
127
+ v-if="data.hero[0].blockType === 'HeroImageBlock'"
128
+ :data="data.hero[0].imageInline"
129
+ :display-caption="data.hero[0].displayCaption"
130
+ :caption="data.hero[0].caption"
131
+ :constrain="data.heroConstrain"
132
+ />
133
+ <BlockImageCarousel
134
+ v-else-if="data.hero[0].blockType === 'CarouselBlock'"
135
+ :items="data.hero[0].blocks"
136
+ :block-id="data.hero[0].id"
137
+ />
138
+ <BlockIframeEmbed
139
+ v-else-if="data.hero[0].blockType === 'IframeEmbedBlock'"
140
+ :data="data.hero[0]"
141
+ />
142
+ <BlockVideo
143
+ v-else-if="data.hero[0].blockType === 'VideoBlock'"
144
+ :data="data.hero[0]"
145
+ autoplay
146
+ />
147
+ <BaseImagePlaceholder
148
+ v-else-if="data.hero[0].blockType === 'VideoEmbedBlock'"
149
+ aspect-ratio="16:9"
150
+ dark-mode
151
+ >
152
+ <div v-html="data.hero[0].embed.embed"></div>
153
+ </BaseImagePlaceholder>
154
+ <BlockImageComparison
155
+ v-else-if="data.hero[0].blockType === 'ImageComparisonBlock'"
156
+ :data="data.hero[0]"
157
+ />
158
+ </LayoutHelper>
159
+
160
+ <!-- summary and topper -->
161
+ <LayoutHelper
162
+ indent="col-3"
163
+ class="lg:mb-8 mb-5"
164
+ >
165
+ <p
166
+ class="text-body-lg font-semibold"
167
+ itemprop="abstract"
168
+ >
169
+ {{ data.summary }}
170
+ </p>
171
+ </LayoutHelper>
172
+
173
+ <!-- streamfield blocks -->
174
+ <BlockStreamfield
175
+ itemprop="articleBody"
176
+ :data="data.body"
177
+ />
178
+
179
+ <!-- related links -->
180
+ <LayoutHelper
181
+ v-if="data.relatedLinks && data.relatedLinks.length"
182
+ indent="col-3"
183
+ class="lg:my-18 my-10"
184
+ >
185
+ <BlockRelatedLinks :data="data.relatedLinks[0]" />
186
+ </LayoutHelper>
187
+
188
+ <!-- related content -->
189
+ <BlockLinkCarousel
190
+ item-type="cards"
191
+ class="lg:my-24 my-12"
192
+ :heading="data.relatedContentHeading"
193
+ :items="data.relatedContent"
194
+ />
195
+ </div>
196
+ </template>