@explorer-1/vue 0.2.23 → 0.2.25

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.
Files changed (26) hide show
  1. package/components.d.ts +2 -0
  2. package/dist/explorer-1-vue.js +4001 -3944
  3. package/dist/explorer-1-vue.umd.cjs +13 -13
  4. package/dist/src/components/BlockLinkCardList/BlockLinkCardList.stories.d.ts +142 -0
  5. package/dist/src/components/BlockLinkCardList/BlockLinkCardList.vue.d.ts +30 -0
  6. package/dist/src/components/MetadataEduResource/MetadataEduResource.stories.d.ts +4 -0
  7. package/dist/src/components/NavSecondary/NavSecondaryDropdown.vue.d.ts +6 -6
  8. package/dist/src/interfaces.d.ts +2 -0
  9. package/dist/src/templates/edu/PageEduTeachableMoment/PageEduTeachableMoment.stories.d.ts +330 -0
  10. package/dist/style.css +1 -1
  11. package/package.json +2 -2
  12. package/src/components/BlockLinkCardList/BlockLinkCardList.stories.js +110 -0
  13. package/src/components/BlockLinkCardList/BlockLinkCardList.vue +34 -0
  14. package/src/components/BlockStreamfield/BlockStreamfield.vue +26 -6
  15. package/src/components/MetadataEduResource/MetadataEduResource.stories.js +4 -1
  16. package/src/components/MetadataEduResource/MetadataEduResource.vue +14 -1
  17. package/src/components/SearchSelectMenu/SearchSelectMenu.vue +1 -1
  18. package/src/constants.ts +7 -1
  19. package/src/docs/foundation/typography.stories.js +2 -0
  20. package/src/interfaces.ts +3 -0
  21. package/src/templates/edu/PageEduLesson/PageEduLesson.stories.js +1 -0
  22. package/src/templates/edu/PageEduLesson/PageEduLesson.vue +15 -11
  23. package/src/templates/edu/PageEduNewsDetail/PageEduNewsDetail.vue +1 -0
  24. package/src/templates/edu/PageEduTeachableMoment/PageEduTeachableMoment.stories.js +142 -0
  25. package/src/templates/edu/PageEduTeachableMoment/PageEduTeachableMoment.vue +217 -0
  26. package/src/utils/rangeifyGrades.ts +1 -1
@@ -0,0 +1,217 @@
1
+ <script setup lang="ts">
2
+ import { computed, reactive, ref } from 'vue'
3
+ import type { PageEduResourcesObject } from './../../../interfaces'
4
+ import HeroMedia from './../../../components/HeroMedia/HeroMedia.vue'
5
+ import BaseImagePlaceholder from './../../../components/BaseImagePlaceholder/BaseImagePlaceholder.vue'
6
+ import BlockImageCarousel from './../../../components/BlockImageCarousel/BlockImageCarousel.vue'
7
+ import BlockImageComparison from './../../../components/BlockImageComparison/BlockImageComparison.vue'
8
+ import BlockLinkCarousel from './../../../components/BlockLinkCarousel/BlockLinkCarousel.vue'
9
+ import BlockVideo from './../../../components/BlockVideo/BlockVideo.vue'
10
+ import LayoutHelper from './../../../components/LayoutHelper/LayoutHelper.vue'
11
+ import DetailHeadline from './../../../components/DetailHeadline/DetailHeadline.vue'
12
+ import BlockImageStandard from './../../../components/BlockImage/BlockImageStandard.vue'
13
+ import ShareButtonsEdu from './../../../components/ShareButtonsEdu/ShareButtonsEdu.vue'
14
+ import BlockStreamfield from './../../../components/BlockStreamfield/BlockStreamfield.vue'
15
+ import BlockIframeEmbed from '../../../components/BlockIframeEmbed/BlockIframeEmbed.vue'
16
+ import BlockRelatedLinks from '../../../components/BlockRelatedLinks/BlockRelatedLinks.vue'
17
+ import NavJumpMenu from './../../../components/NavJumpMenu/NavJumpMenu.vue'
18
+
19
+ interface PageEduTeachableMomentProps {
20
+ data?: PageEduResourcesObject
21
+ }
22
+
23
+ const props = withDefaults(defineProps<PageEduTeachableMomentProps>(), {
24
+ data: undefined
25
+ })
26
+
27
+ const { data } = reactive(props)
28
+
29
+ const PageEduTeachableMomentJumpMenu = ref()
30
+
31
+ defineExpose({
32
+ PageEduTeachableMomentJumpMenu
33
+ })
34
+
35
+ const heroEmpty = computed((): boolean => {
36
+ return data?.hero?.length === 0
37
+ })
38
+
39
+ const heroInline = computed((): boolean => {
40
+ // heroes with interactive elements have special handling
41
+ if (!heroEmpty.value && data?.hero) {
42
+ // excludes VideoBlock as this will autoplay
43
+ if (data?.hero[0].blockType === 'VideoBlock') {
44
+ return false
45
+ } else if (
46
+ data?.hero[0].blockType === 'CarouselBlock' ||
47
+ data?.hero[0].blockType === 'IframeEmbedBlock' ||
48
+ data?.hero[0].blockType === 'VideoEmbedBlock' ||
49
+ data?.hero[0].blockType === 'ImageComparisonBlock'
50
+ ) {
51
+ return true
52
+ }
53
+ }
54
+ return false
55
+ })
56
+
57
+ const computedClass = computed((): string => {
58
+ if (heroInline.value || heroEmpty.value) {
59
+ return 'pt-5 lg:pt-12'
60
+ } else if (!heroInline.value) {
61
+ return '-nav-offset'
62
+ }
63
+ return ''
64
+ })
65
+ </script>
66
+ <template>
67
+ <div
68
+ v-if="data"
69
+ class="ThemeEdu ThemeVariantLight"
70
+ :class="computedClass"
71
+ >
72
+ <NavJumpMenu
73
+ ref="PageEduTeachableMomentJumpMenu"
74
+ :title="data.title"
75
+ :blocks="data.body"
76
+ :enabled="data.showJumpMenu"
77
+ dropdown-text="In this Teachable Moment"
78
+ />
79
+
80
+ <!-- hero media -->
81
+ <HeroMedia
82
+ v-if="
83
+ !heroEmpty &&
84
+ !heroInline &&
85
+ data?.hero?.length &&
86
+ (data.hero[0].blockType === 'HeroImageBlock' || data.hero[0].blockType === 'VideoBlock')
87
+ "
88
+ class="md:mb-12 lg:mb-18 mb-10"
89
+ :image="data.hero[0].image"
90
+ :video="data.hero[0].video"
91
+ :display-caption="data.hero[0].displayCaption"
92
+ :caption="data.hero[0].caption"
93
+ :credit="data.hero[0].credit"
94
+ :constrain="data.heroConstrain"
95
+ />
96
+
97
+ <LayoutHelper
98
+ indent="col-2"
99
+ class="mb-10"
100
+ >
101
+ <DetailHeadline
102
+ :title="data.title"
103
+ label="Teachable Moment"
104
+ pill
105
+ />
106
+ <ShareButtonsEdu
107
+ v-if="data?.url"
108
+ class="mt-4"
109
+ :url="data.url"
110
+ :title="data.title"
111
+ :image="data.thumbnailImage?.original"
112
+ />
113
+ </LayoutHelper>
114
+
115
+ <!-- TODO: put this in a component (exclude layout though) -->
116
+ <LayoutHelper
117
+ v-if="!heroEmpty && heroInline && data.hero?.length"
118
+ class="lg:mb-22 mb-10"
119
+ >
120
+ <BlockImageStandard
121
+ v-if="data.hero[0].blockType === 'HeroImageBlock'"
122
+ :data="data.hero[0].imageInline"
123
+ :display-caption="data.hero[0].displayCaption"
124
+ :caption="data.hero[0].caption"
125
+ :constrain="data.heroConstrain"
126
+ />
127
+ <BlockImageCarousel
128
+ v-else-if="data.hero[0].blockType === 'CarouselBlock'"
129
+ :items="data.hero[0].blocks"
130
+ :block-id="data.hero[0].id"
131
+ />
132
+ <BlockIframeEmbed
133
+ v-else-if="data.hero[0].blockType === 'IframeEmbedBlock'"
134
+ :data="data.hero[0]"
135
+ />
136
+ <BlockVideo
137
+ v-else-if="data.hero[0].blockType === 'VideoBlock'"
138
+ :data="data.hero[0]"
139
+ autoplay
140
+ />
141
+ <BaseImagePlaceholder
142
+ v-else-if="data.hero[0].blockType === 'VideoEmbedBlock'"
143
+ aspect-ratio="16:9"
144
+ dark-mode
145
+ >
146
+ <div v-html="data.hero[0].embed?.embed"></div>
147
+ </BaseImagePlaceholder>
148
+ <BlockImageComparison
149
+ v-else-if="data.hero[0].blockType === 'ImageComparisonBlock'"
150
+ :data="data.hero[0]"
151
+ />
152
+ </LayoutHelper>
153
+
154
+ <!-- summary and topper -->
155
+ <LayoutHelper
156
+ indent="col-3"
157
+ class="lg:mb-8 mb-5"
158
+ >
159
+ <BlockText
160
+ v-if="data.topper && data.topper.length > 2"
161
+ class="lg:mb-8 mb-5"
162
+ :text="data.topper"
163
+ />
164
+ </LayoutHelper>
165
+ <!-- streamfield blocks -->
166
+ <BlockStreamfield
167
+ itemprop="articleBody"
168
+ :data="data.body"
169
+ />
170
+
171
+ <!-- streamfield blocks -->
172
+ <BlockStreamfield :data="data.body" />
173
+
174
+ <!-- related links -->
175
+ <LayoutHelper
176
+ v-if="data.relatedLinks && data.relatedLinks.length"
177
+ indent="col-3"
178
+ class="lg:my-18 my-10"
179
+ >
180
+ <BlockRelatedLinks :data="data.relatedLinks[0]" />
181
+ </LayoutHelper>
182
+
183
+ <!-- related content -->
184
+ <BlockLinkCarousel
185
+ v-if="data.relatedContent?.length"
186
+ item-type="cards"
187
+ class="lg:my-24 my-12 print:px-4"
188
+ :heading="data.relatedContentHeading"
189
+ :items="data.relatedContent"
190
+ />
191
+
192
+ <LayoutHelper
193
+ v-if="data.lastPublishedAt"
194
+ indent="col-3"
195
+ class="lg:my-18 my-10"
196
+ >
197
+ <p class="border-t border-gray-light-mid pt-8">
198
+ <strong>Teachable Moment Last Updated:</strong>
199
+ {{
200
+ // @ts-ignore
201
+ $filters.displayDate(data.lastPublishedAt)
202
+ }}
203
+ </p>
204
+ </LayoutHelper>
205
+ <!-- explore more -->
206
+ <div
207
+ v-if="data.relatedContent?.length"
208
+ class="bg-stars bg-primary-darker pt-14 pb-20 ThemeVariantDark text-white"
209
+ >
210
+ <BlockLinkCarousel
211
+ item-type="cards"
212
+ heading="Explore more"
213
+ :items="data.relatedContent"
214
+ />
215
+ </div>
216
+ </div>
217
+ </template>
@@ -63,7 +63,7 @@ export const rangeifyGrades = (gradeLevels: GradeLevelsObject[]) => {
63
63
  const filteredGrades = rangeify(gradesArray.filter(Number.isFinite))
64
64
  let preparedGrades: string = ''
65
65
  if (filteredGrades?.length) {
66
- const gradeString = filteredGrades.length > 0 ? 'Grades: ' : 'Grade: '
66
+ const gradeString = filteredGrades.length > 0 ? 'Grades ' : 'Grade '
67
67
  preparedGrades = filteredGrades
68
68
  .map((grade, index) => (index === 0 ? gradeString + grade : grade))
69
69
  .join(', ')