@explorer-1/vue 0.2.23 → 0.2.24
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.
- package/package.json +2 -2
- package/src/components/BlockLinkCardList/BlockLinkCardList.stories.js +110 -0
- package/src/components/BlockLinkCardList/BlockLinkCardList.vue +34 -0
- package/src/components/BlockStreamfield/BlockStreamfield.vue +26 -6
- package/src/components/MetadataEduResource/MetadataEduResource.stories.js +4 -1
- package/src/components/MetadataEduResource/MetadataEduResource.vue +14 -1
- package/src/components/SearchSelectMenu/SearchSelectMenu.vue +1 -1
- package/src/docs/foundation/typography.stories.js +2 -0
- package/src/interfaces.ts +1 -0
- package/src/utils/rangeifyGrades.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@explorer-1/vue",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.24",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vue-bind-once": "^0.2.1",
|
|
31
31
|
"vue-observe-visibility": "^1.0.0",
|
|
32
32
|
"vue3-compare-image": "^1.2.5",
|
|
33
|
-
"@explorer-1/common": "1.1.
|
|
33
|
+
"@explorer-1/common": "1.1.6"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@vitejs/plugin-vue": "^5.0.4",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import BlockLinkCardList from './BlockLinkCardList.vue'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Blocks/BlockLinkCardList',
|
|
5
|
+
component: BlockLinkCardList,
|
|
6
|
+
tags: ['!autodocs'],
|
|
7
|
+
excludeStories: /.*Data$/
|
|
8
|
+
}
|
|
9
|
+
export const BlockLinkCardData = {
|
|
10
|
+
data: {
|
|
11
|
+
url: '/news/placeholder-slug-1',
|
|
12
|
+
title: 'How engineers at NASA-JPL persevered to develop a ventilator',
|
|
13
|
+
slug: 'placeholder-slug-1',
|
|
14
|
+
label: 'Solar System',
|
|
15
|
+
thumbnailImage: {
|
|
16
|
+
src: {
|
|
17
|
+
url: 'https://picsum.photos/512/288',
|
|
18
|
+
width: 512,
|
|
19
|
+
height: 288
|
|
20
|
+
},
|
|
21
|
+
alt: 'Alt text'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
headingLevel: 'h2',
|
|
25
|
+
startDate: undefined,
|
|
26
|
+
endDate: undefined
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const BlockLinkCardCarouselData = [
|
|
30
|
+
{
|
|
31
|
+
page: {
|
|
32
|
+
...BlockLinkCardData.data,
|
|
33
|
+
__typename: 'EDUEventPage',
|
|
34
|
+
startDate: '2021-11-11',
|
|
35
|
+
startDatetime: '2021-11-11T00:00:00-08:00',
|
|
36
|
+
endDatetime: '2021-11-11T23:59:59.999999-08:00',
|
|
37
|
+
endDate: '2021-11-11',
|
|
38
|
+
ongoing: false,
|
|
39
|
+
eventType: 'Workshop'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
page: {
|
|
44
|
+
summary:
|
|
45
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at tortor placerat, varius ante in, imperdiet dolor. Morbi vel arcu eu purus efficitur consequat sit amet vel nisi. Duis convallis volutpat scelerisque.',
|
|
46
|
+
|
|
47
|
+
...BlockLinkCardData.data,
|
|
48
|
+
__typename: 'EDULessonPage',
|
|
49
|
+
primarySubject: {
|
|
50
|
+
subject: 'Math'
|
|
51
|
+
},
|
|
52
|
+
gradeLevels: [
|
|
53
|
+
{ gradeLevel: 'K' },
|
|
54
|
+
{ gradeLevel: '1' },
|
|
55
|
+
{ gradeLevel: '2' },
|
|
56
|
+
{ gradeLevel: '8' }
|
|
57
|
+
],
|
|
58
|
+
time: {
|
|
59
|
+
time: '1-2 hrs'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
page: {
|
|
65
|
+
...BlockLinkCardData.data,
|
|
66
|
+
__typename: 'EDUExplainerArticlePage',
|
|
67
|
+
summary:
|
|
68
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at tortor placerat, varius ante in, imperdiet dolor. Morbi vel arcu eu purus efficitur consequat sit amet vel nisi. Duis convallis volutpat scelerisque.',
|
|
69
|
+
primarySubject: {
|
|
70
|
+
subject: 'Engineering'
|
|
71
|
+
},
|
|
72
|
+
gradeLevels: [
|
|
73
|
+
{ gradeLevel: 'All Ages' },
|
|
74
|
+
{ gradeLevel: 'K' },
|
|
75
|
+
{ gradeLevel: '1' },
|
|
76
|
+
{ gradeLevel: '2' },
|
|
77
|
+
{ gradeLevel: '5' },
|
|
78
|
+
{ gradeLevel: '6' },
|
|
79
|
+
{ gradeLevel: '7' },
|
|
80
|
+
{ gradeLevel: '8' }
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
url: '/news/placeholder-slug-4',
|
|
86
|
+
title: 'How engineers at NASA-JPL persevered to develop a ventilator',
|
|
87
|
+
slug: 'placeholder-slug-4',
|
|
88
|
+
summary:
|
|
89
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse at tortor placerat, varius ante in, imperdiet dolor. Morbi vel arcu eu purus efficitur consequat sit amet vel nisi. Duis convallis volutpat scelerisque.',
|
|
90
|
+
label: 'Technology',
|
|
91
|
+
thumbnailImage: {
|
|
92
|
+
src: {
|
|
93
|
+
url: 'https://picsum.photos/512/288',
|
|
94
|
+
width: 512,
|
|
95
|
+
height: 288
|
|
96
|
+
},
|
|
97
|
+
alt: 'Alt text'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
// stories
|
|
103
|
+
export const BaseStory = {
|
|
104
|
+
name: 'BlockLinkCardList',
|
|
105
|
+
args: {
|
|
106
|
+
itemType: 'cards',
|
|
107
|
+
heading: 'Related Pages',
|
|
108
|
+
items: BlockLinkCardCarouselData
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Card } from './../../interfaces'
|
|
3
|
+
import BlockLinkCard from './../BlockLinkCard/BlockLinkCard.vue'
|
|
4
|
+
|
|
5
|
+
export interface BlockLinkCardListProps {
|
|
6
|
+
items: Card[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const props = withDefaults(defineProps<BlockLinkCardListProps>(), {
|
|
10
|
+
items: undefined
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
<template>
|
|
14
|
+
<div class="BlockLinkCardList">
|
|
15
|
+
<!-- Slides -->
|
|
16
|
+
<BlockLinkCard
|
|
17
|
+
v-for="(item, index) in props.items"
|
|
18
|
+
:key="index"
|
|
19
|
+
class="border-b border-gray-light-mid mb-5"
|
|
20
|
+
:class="{ 'pt-3': index !== 0 }"
|
|
21
|
+
:data="item"
|
|
22
|
+
size="lg"
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
<style lang="scss">
|
|
27
|
+
.BlockLinkCardList {
|
|
28
|
+
.BlockLinkCard {
|
|
29
|
+
div.bg-gray-dark.relative.mb-6 {
|
|
30
|
+
@apply mb-3 #{!important};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -207,6 +207,23 @@
|
|
|
207
207
|
<BlockCardGrid :cards="block.items" />
|
|
208
208
|
</div>
|
|
209
209
|
|
|
210
|
+
<div
|
|
211
|
+
v-else-if="block.blockType === 'LinkCarouselBlock' && block.blocks?.length"
|
|
212
|
+
:key="`linkCarouselBlock${index}`"
|
|
213
|
+
class="lg:mb-18 mb-10"
|
|
214
|
+
>
|
|
215
|
+
<BlockLinkCarousel :items="block.blocks" />
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<LayoutHelper
|
|
219
|
+
v-else-if="block.blockType === 'LinkCardListBlock' && block.blocks?.length"
|
|
220
|
+
:key="`linkCardListBlock${index}`"
|
|
221
|
+
indent="col-3"
|
|
222
|
+
class="lg:mb-18 mb-10"
|
|
223
|
+
>
|
|
224
|
+
<BlockLinkCardList :items="block.blocks" />
|
|
225
|
+
</LayoutHelper>
|
|
226
|
+
|
|
210
227
|
<LayoutHelper
|
|
211
228
|
v-else-if="block.blockType == 'AccordionBlock'"
|
|
212
229
|
:key="`accordionBlock${index}`"
|
|
@@ -231,6 +248,8 @@ import { defineComponent } from 'vue'
|
|
|
231
248
|
import type { PropType } from 'vue'
|
|
232
249
|
import type { StreamfieldBlockData } from '../../interfaces'
|
|
233
250
|
import LayoutHelper from './../LayoutHelper/LayoutHelper.vue'
|
|
251
|
+
import BlockAnchor from './../BlockAnchor/BlockAnchor.vue'
|
|
252
|
+
import BlockAccordion, { type AccordionBlockObject } from './../BlockAccordion/BlockAccordion.vue'
|
|
234
253
|
import BlockCardGrid from './../BlockCardGrid/BlockCardGrid.vue'
|
|
235
254
|
import BlockCta from './../BlockCta/BlockCta.vue'
|
|
236
255
|
import BlockHeading, { BlockHeadingObject } from './../BlockHeading/BlockHeading.vue'
|
|
@@ -240,6 +259,8 @@ import BlockImageComparison from './../BlockImageComparison/BlockImageComparison
|
|
|
240
259
|
import BlockImageGallery from './../BlockImageGallery/BlockImageGallery.vue'
|
|
241
260
|
import BlockInlineImage from './../BlockInlineImage/BlockInlineImage.vue'
|
|
242
261
|
import BlockKeyPoints from './../BlockKeyPoints/BlockKeyPoints.vue'
|
|
262
|
+
import BlockLinkCardList from './../BlockLinkCardList/BlockLinkCardList.vue'
|
|
263
|
+
import BlockLinkCarousel from './../BlockLinkCarousel/BlockLinkCarousel.vue'
|
|
243
264
|
import BlockListCards from './../BlockListCards/BlockListCards.vue'
|
|
244
265
|
import BlockQuote, { type BlockQuoteAttributes } from './../BlockQuote/BlockQuote.vue'
|
|
245
266
|
import BlockRelatedLinks, {
|
|
@@ -255,9 +276,6 @@ import BlockVideo from './../BlockVideo/BlockVideo.vue'
|
|
|
255
276
|
import BlockVideoEmbed, {
|
|
256
277
|
type BlockData as VideoBlockEmbedData
|
|
257
278
|
} from './../BlockVideoEmbed/BlockVideoEmbed.vue'
|
|
258
|
-
import BlockAnchor from './../BlockAnchor/BlockAnchor.vue'
|
|
259
|
-
import BlockAccordion from './../BlockAccordion/BlockAccordion.vue'
|
|
260
|
-
import { type AccordionBlockObject } from './../BlockAccordion/BlockAccordion.vue'
|
|
261
279
|
|
|
262
280
|
interface Variants {
|
|
263
281
|
[key: string]: string
|
|
@@ -272,6 +290,8 @@ export default defineComponent({
|
|
|
272
290
|
name: 'BlockStreamfield',
|
|
273
291
|
components: {
|
|
274
292
|
LayoutHelper,
|
|
293
|
+
BlockAnchor,
|
|
294
|
+
BlockAccordion,
|
|
275
295
|
BlockCardGrid,
|
|
276
296
|
BlockCta,
|
|
277
297
|
BlockHeading,
|
|
@@ -281,6 +301,8 @@ export default defineComponent({
|
|
|
281
301
|
BlockImageGallery,
|
|
282
302
|
BlockInlineImage,
|
|
283
303
|
BlockKeyPoints,
|
|
304
|
+
BlockLinkCardList,
|
|
305
|
+
BlockLinkCarousel,
|
|
284
306
|
BlockListCards,
|
|
285
307
|
BlockQuote,
|
|
286
308
|
BlockRelatedLinks,
|
|
@@ -291,9 +313,7 @@ export default defineComponent({
|
|
|
291
313
|
BlockIframeEmbed,
|
|
292
314
|
BlockGist,
|
|
293
315
|
BlockVideo,
|
|
294
|
-
BlockVideoEmbed
|
|
295
|
-
BlockAnchor,
|
|
296
|
-
BlockAccordion
|
|
316
|
+
BlockVideoEmbed
|
|
297
317
|
},
|
|
298
318
|
props: {
|
|
299
319
|
variant: {
|
|
@@ -3,7 +3,7 @@ import { computed } from 'vue'
|
|
|
3
3
|
import type { EduResourceCardObject } from './../../interfaces.ts'
|
|
4
4
|
import IconSubject from './../Icons/IconSubject.vue'
|
|
5
5
|
import IconProfile from './../Icons/IconProfile.vue'
|
|
6
|
-
|
|
6
|
+
import IconTime from './../Icons/IconTime.vue'
|
|
7
7
|
import {} from './../../utils/mixins'
|
|
8
8
|
import { rangeifyGrades } from './../../utils/rangeifyGrades'
|
|
9
9
|
|
|
@@ -29,6 +29,9 @@ const primarySubject = computed(() => {
|
|
|
29
29
|
const audience = computed(() => {
|
|
30
30
|
return rangeifyGrades(props.resource?.gradeLevels)
|
|
31
31
|
})
|
|
32
|
+
const time = computed(() => {
|
|
33
|
+
return props.resource?.time?.time
|
|
34
|
+
})
|
|
32
35
|
</script>
|
|
33
36
|
<template>
|
|
34
37
|
<div
|
|
@@ -57,6 +60,16 @@ const audience = computed(() => {
|
|
|
57
60
|
/>
|
|
58
61
|
<span>{{ audience }}</span>
|
|
59
62
|
</div>
|
|
63
|
+
<div
|
|
64
|
+
v-if="time"
|
|
65
|
+
class="MetadataEduResourceItem"
|
|
66
|
+
>
|
|
67
|
+
<IconTime
|
|
68
|
+
class="MetadataEduResourceIcon text-[1.15em]"
|
|
69
|
+
:class="iconClass"
|
|
70
|
+
/>
|
|
71
|
+
<span>{{ time }}</span>
|
|
72
|
+
</div>
|
|
60
73
|
</div>
|
|
61
74
|
</template>
|
|
62
75
|
<style lang="scss">
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<select
|
|
9
9
|
:id="generateId()"
|
|
10
10
|
v-model="selectValueHandler"
|
|
11
|
-
class="border-0 text-
|
|
11
|
+
class="border-0 text-action can-hover:hover:text-action-dark font-secondary font-semibold tracking-wider uppercase align-middle"
|
|
12
12
|
>
|
|
13
13
|
<option
|
|
14
14
|
disabled
|
|
@@ -78,6 +78,8 @@ export const TextStyles = {
|
|
|
78
78
|
<code>.text-body-xs</code>
|
|
79
79
|
<p class="mt-8"><mark>Highlighted text</mark></p>
|
|
80
80
|
<code>mark</code>
|
|
81
|
+
<p class="mt-8"><span class="math-text">This is math text. a<sup>2</sup> + a<sub>b</sub> = c</span></p>
|
|
82
|
+
<code>.math-text</code>
|
|
81
83
|
</div>`
|
|
82
84
|
})
|
|
83
85
|
}
|
package/src/interfaces.ts
CHANGED
|
@@ -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
|
|
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(', ')
|