@explorer-1/vue 0.1.5 → 0.1.7

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,197 @@
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
+ this.data?.hero[0].blockType === 'VideoEmbedBlock'
51
+ ) {
52
+ return true
53
+ }
54
+ }
55
+ return false
56
+ },
57
+ computedClass(): string {
58
+ if (this.heroInline || this.heroEmpty) {
59
+ return 'pt-5 lg:pt-12'
60
+ } else if (!this.heroInline) {
61
+ return '-nav-offset'
62
+ }
63
+ return ''
64
+ }
65
+ }
66
+ })
67
+ </script>
68
+ <template>
69
+ <div
70
+ v-if="data"
71
+ class="ThemeVariantLight"
72
+ :class="computedClass"
73
+ itemscope
74
+ itemtype="http://schema.org/Article"
75
+ >
76
+ <!-- schema.org -->
77
+ <meta
78
+ v-if="data.thumbnailImage && data.thumbnailImage.original"
79
+ itemprop="image"
80
+ :content="data.thumbnailImage.original"
81
+ />
82
+
83
+ <!-- hero image -->
84
+ <HeroMedia
85
+ v-if="
86
+ !heroEmpty &&
87
+ !heroInline &&
88
+ (data.hero[0].blockType === 'HeroImageBlock' || data.hero[0].blockType === 'VideoBlock')
89
+ "
90
+ class="md:mb-12 lg:mb-18 mb-10"
91
+ :image="data.hero[0].image"
92
+ :video="data.hero[0].video"
93
+ :display-caption="data.hero[0].displayCaption"
94
+ :caption="data.hero[0].caption"
95
+ :credit="data.hero[0].credit"
96
+ :constrain="data.heroConstrain"
97
+ />
98
+
99
+ <!-- news headline and author -->
100
+ <LayoutHelper
101
+ indent="col-2"
102
+ class="mb-10"
103
+ >
104
+ <DetailHeadline
105
+ :title="data.title"
106
+ :publication-date="data.publicationDate"
107
+ :publication-time="data.publicationTime"
108
+ :author="data.author"
109
+ :label="data.displayLabel"
110
+ schema
111
+ />
112
+ <ShareButtonsEdu
113
+ v-if="data?.url"
114
+ class="mt-4"
115
+ :url="data.url"
116
+ :title="data.title"
117
+ :image="data.thumbnailImage?.original"
118
+ />
119
+ </LayoutHelper>
120
+
121
+ <!-- inline hero content -->
122
+ <LayoutHelper
123
+ v-if="!heroEmpty && heroInline"
124
+ indent="col-2"
125
+ class="lg:mb-22 mt-10 mb-10"
126
+ >
127
+ <BlockImageStandard
128
+ v-if="data.hero[0].blockType === 'HeroImageBlock'"
129
+ :data="data.hero[0].imageInline"
130
+ :display-caption="data.hero[0].displayCaption"
131
+ :caption="data.hero[0].caption"
132
+ :constrain="data.heroConstrain"
133
+ />
134
+ <BlockImageCarousel
135
+ v-else-if="data.hero[0].blockType === 'CarouselBlock'"
136
+ :items="data.hero[0].blocks"
137
+ :block-id="data.hero[0].id"
138
+ />
139
+ <BlockIframeEmbed
140
+ v-else-if="data.hero[0].blockType === 'IframeEmbedBlock'"
141
+ :data="data.hero[0]"
142
+ />
143
+ <BlockVideo
144
+ v-else-if="data.hero[0].blockType === 'VideoBlock'"
145
+ :data="data.hero[0]"
146
+ autoplay
147
+ />
148
+ <BaseImagePlaceholder
149
+ v-else-if="data.hero[0].blockType === 'VideoEmbedBlock'"
150
+ aspect-ratio="16:9"
151
+ dark-mode
152
+ >
153
+ <div v-html="data.hero[0].embed.embed"></div>
154
+ </BaseImagePlaceholder>
155
+ <BlockImageComparison
156
+ v-else-if="data.hero[0].blockType === 'ImageComparisonBlock'"
157
+ :data="data.hero[0]"
158
+ />
159
+ </LayoutHelper>
160
+
161
+ <!-- summary and topper -->
162
+ <LayoutHelper
163
+ indent="col-3"
164
+ class="lg:mb-8 mb-5"
165
+ >
166
+ <p
167
+ class="text-body-lg font-semibold"
168
+ itemprop="abstract"
169
+ >
170
+ {{ data.summary }}
171
+ </p>
172
+ </LayoutHelper>
173
+
174
+ <!-- streamfield blocks -->
175
+ <BlockStreamfield
176
+ itemprop="articleBody"
177
+ :data="data.body"
178
+ />
179
+
180
+ <!-- related links -->
181
+ <LayoutHelper
182
+ v-if="data.relatedLinks && data.relatedLinks.length"
183
+ indent="col-3"
184
+ class="lg:my-18 my-10"
185
+ >
186
+ <BlockRelatedLinks :data="data.relatedLinks[0]" />
187
+ </LayoutHelper>
188
+
189
+ <!-- related content -->
190
+ <BlockLinkCarousel
191
+ item-type="cards"
192
+ class="lg:my-24 my-12"
193
+ :heading="data.relatedContentHeading"
194
+ :items="data.relatedContent"
195
+ />
196
+ </div>
197
+ </template>