@explorer-1/vue 0.2.44 → 0.2.46
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 +1 -1
- package/src/components/BaseButton/BaseButton.vue +11 -10
- package/src/components/BlockLinkCard/BlockLinkCard.vue +7 -1
- package/src/components/SearchFilterGroup/SearchFilterGroup.vue +18 -7
- package/src/components/SearchResultCard/SearchResultCard.vue +6 -1
- package/src/components/SearchResultGridItem/SearchResultGridItem.vue +6 -1
- package/src/components/SearchResultsList/SearchResultsList.vue +6 -0
- package/src/interfaces.ts +4 -2
- package/src/templates/edu/PageEduLesson/PageEduLesson.stories.js +1 -1
- package/src/templates/edu/PageEduLesson/PageEduLesson.vue +23 -22
- package/src/utils/generateHash.ts +9 -0
package/package.json
CHANGED
|
@@ -65,16 +65,6 @@ export default defineComponent({
|
|
|
65
65
|
return 'button'
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
// necessary for valid html
|
|
69
|
-
// must account for <a>, <nuxt-link>, and <button> use-cases
|
|
70
|
-
theHref(): string | undefined {
|
|
71
|
-
if (this.tag === 'nuxt-link') {
|
|
72
|
-
return this.to as string
|
|
73
|
-
} else if (this.tag === 'a') {
|
|
74
|
-
return this.href
|
|
75
|
-
}
|
|
76
|
-
return undefined
|
|
77
|
-
},
|
|
78
68
|
computedTo() {
|
|
79
69
|
let toValue = this.to
|
|
80
70
|
// filter out unnecessary `/home/` prefix from wagtail default site urlPaths
|
|
@@ -83,6 +73,17 @@ export default defineComponent({
|
|
|
83
73
|
}
|
|
84
74
|
return toValue
|
|
85
75
|
},
|
|
76
|
+
// necessary for valid html
|
|
77
|
+
// must account for <a>, <nuxt-link>, and <button> use-cases
|
|
78
|
+
theHref(): string | undefined {
|
|
79
|
+
let href = undefined
|
|
80
|
+
if (this.computedTo && typeof this.computedTo === 'string') {
|
|
81
|
+
href = this.computedTo
|
|
82
|
+
} else if (this.tag === 'a') {
|
|
83
|
+
href = this.href
|
|
84
|
+
}
|
|
85
|
+
return href
|
|
86
|
+
},
|
|
86
87
|
variantClass(): string {
|
|
87
88
|
let classes = variants[this.variant]
|
|
88
89
|
if (!this.$slots.default && this.$slots.icon) {
|
|
@@ -96,9 +96,15 @@
|
|
|
96
96
|
>
|
|
97
97
|
{{ theItem.title }}
|
|
98
98
|
</component>
|
|
99
|
+
<p
|
|
100
|
+
v-if="(theItem as EventCardObject).targetAudience"
|
|
101
|
+
:class="{ 'mt-2': !large, 'mt-4': large }"
|
|
102
|
+
>
|
|
103
|
+
<strong>Target Audience:</strong> {{ (theItem as EventCardObject).targetAudience }}
|
|
104
|
+
</p>
|
|
99
105
|
<p
|
|
100
106
|
v-if="theItem.date && !themeStore.isEdu"
|
|
101
|
-
class="text-gray-mid-dark
|
|
107
|
+
class="text-gray-mid-dark"
|
|
102
108
|
:class="{ 'mt-2': !large, 'mt-4': large }"
|
|
103
109
|
>
|
|
104
110
|
{{ theItem.date }}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
v-if="
|
|
4
|
-
typeof groupKey !== 'undefined' &&
|
|
5
|
-
typeof buckets !== 'undefined' &&
|
|
6
|
-
bucketsLength >= 1 &&
|
|
7
|
-
!hideFilterGroups.includes(groupKey)
|
|
8
|
-
"
|
|
3
|
+
v-if="showFilterGroup"
|
|
9
4
|
:id="`filterGroup_${groupKey}`"
|
|
10
5
|
class="border-gray-light-mid col-span-3 pb-4 mb-4 border-b"
|
|
11
6
|
>
|
|
@@ -13,7 +8,10 @@
|
|
|
13
8
|
<legend class="md:mb-3 text-body-md mb-2 font-bold leading-normal tracking-wide">
|
|
14
9
|
{{ groupTitle }}
|
|
15
10
|
</legend>
|
|
16
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
v-if="buckets?.length"
|
|
13
|
+
class="buckets"
|
|
14
|
+
>
|
|
17
15
|
<div
|
|
18
16
|
v-for="(bucket, index) in buckets"
|
|
19
17
|
:key="bucket.key"
|
|
@@ -43,6 +41,7 @@
|
|
|
43
41
|
</div>
|
|
44
42
|
</div>
|
|
45
43
|
</div>
|
|
44
|
+
<div v-else><span class="text-sm text-gray-mid-dark">No matching filters</span></div>
|
|
46
45
|
<!--
|
|
47
46
|
TODO: this logic could probably cleaner. It flows in the opposite way of the loop
|
|
48
47
|
for making checkboxes above.
|
|
@@ -116,6 +115,18 @@ export default {
|
|
|
116
115
|
},
|
|
117
116
|
bucketsLength() {
|
|
118
117
|
return this.buckets.length
|
|
118
|
+
},
|
|
119
|
+
showFilterGroup() {
|
|
120
|
+
if (this.themeStore.isEdu) {
|
|
121
|
+
return this.groupTitle && !this.hideFilterGroups.includes(this.groupKey)
|
|
122
|
+
} else {
|
|
123
|
+
return (
|
|
124
|
+
typeof this.groupKey !== 'undefined' &&
|
|
125
|
+
typeof this.buckets !== 'undefined' &&
|
|
126
|
+
this.bucketsLength >= 1 &&
|
|
127
|
+
!this.hideFilterGroups.includes(this.groupKey)
|
|
128
|
+
)
|
|
129
|
+
}
|
|
119
130
|
}
|
|
120
131
|
},
|
|
121
132
|
watch: {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
ongoing,
|
|
25
25
|
primarySubject,
|
|
26
26
|
gradeLevels,
|
|
27
|
-
time
|
|
27
|
+
time,
|
|
28
|
+
targetAudience
|
|
28
29
|
}
|
|
29
30
|
}"
|
|
30
31
|
show-calendar-chip
|
|
@@ -343,6 +344,10 @@ export default defineComponent({
|
|
|
343
344
|
type: Boolean,
|
|
344
345
|
default: false
|
|
345
346
|
},
|
|
347
|
+
targetAudience: {
|
|
348
|
+
type: String,
|
|
349
|
+
default: undefined
|
|
350
|
+
},
|
|
346
351
|
primarySubject: {
|
|
347
352
|
type: Object as PropType<PrimarySubjectObject>,
|
|
348
353
|
default: undefined
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
ongoing,
|
|
22
22
|
primarySubject,
|
|
23
23
|
gradeLevels,
|
|
24
|
-
time
|
|
24
|
+
time,
|
|
25
|
+
targetAudience
|
|
25
26
|
}
|
|
26
27
|
}"
|
|
27
28
|
:heading-level="headingLevel"
|
|
@@ -174,6 +175,10 @@ export default defineComponent({
|
|
|
174
175
|
type: Boolean,
|
|
175
176
|
default: false
|
|
176
177
|
},
|
|
178
|
+
targetAudience: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: undefined
|
|
181
|
+
},
|
|
177
182
|
location: {
|
|
178
183
|
type: String,
|
|
179
184
|
default: undefined
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
:end-time="page.endTime"
|
|
31
31
|
:event-type="page.eventType"
|
|
32
32
|
:ongoing="page.ongoing"
|
|
33
|
+
:target-audience="page.targetAudience"
|
|
33
34
|
:location="page.location"
|
|
34
35
|
:primary-subject="page.primarySubject as unknown as PrimarySubjectObject"
|
|
35
36
|
:grade-levels="page.gradeLevels as unknown as GradeLevelsObject[]"
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
:end-time="page.endTime"
|
|
56
57
|
:event-type="page.eventType"
|
|
57
58
|
:ongoing="page.ongoing"
|
|
59
|
+
:target-audience="page.targetAudience"
|
|
58
60
|
:location="page.location"
|
|
59
61
|
:primary-subject="page.primarySubject as unknown as PrimarySubjectObject"
|
|
60
62
|
:grade-levels="page.gradeLevels as unknown as GradeLevelsObject[]"
|
|
@@ -216,6 +218,10 @@ export default defineComponent({
|
|
|
216
218
|
handle === 'edu_events_edueventpage'
|
|
217
219
|
? page._source.edu_events_edueventpage__ongoing
|
|
218
220
|
: undefined
|
|
221
|
+
page.targetAudience =
|
|
222
|
+
handle === 'edu_events_edueventpage'
|
|
223
|
+
? page._source.edu_events_edueventpage__target_audience
|
|
224
|
+
: undefined
|
|
219
225
|
// edu resources
|
|
220
226
|
page.gradeLevels = gradeLevels
|
|
221
227
|
page.time = time
|
package/src/interfaces.ts
CHANGED
|
@@ -93,8 +93,9 @@ export interface ElasticSearchPage {
|
|
|
93
93
|
eventType?: string
|
|
94
94
|
ongoing?: boolean
|
|
95
95
|
primarySubject?: string
|
|
96
|
-
gradeLevels
|
|
97
|
-
time
|
|
96
|
+
gradeLevels?: string
|
|
97
|
+
time?: string
|
|
98
|
+
targetAudience?: string
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
export interface FormOption {
|
|
@@ -136,6 +137,7 @@ export interface EventCardObject extends Card {
|
|
|
136
137
|
locationName?: string
|
|
137
138
|
location?: string
|
|
138
139
|
locationLink?: string
|
|
140
|
+
targetAudience?: string
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export interface PrimarySubjectObject {
|
|
@@ -130,13 +130,16 @@ const sectionOrder = [
|
|
|
130
130
|
const staticSectionHeadings = computed((): { [key: string]: BlockHeadingObject } | undefined => {
|
|
131
131
|
if (data) {
|
|
132
132
|
const result = sectionOrder.reduce<Record<string, BlockHeadingObject>>((acc, section) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
// only include the heading if the section has content
|
|
134
|
+
if (data[section]?.length) {
|
|
135
|
+
const headingText =
|
|
136
|
+
section === 'techAddons'
|
|
137
|
+
? 'Tech Add-ons'
|
|
138
|
+
: section.charAt(0).toUpperCase() + section.slice(1)
|
|
139
|
+
acc[section] = stringAsHeadingBlockData(
|
|
140
|
+
(data[`${section}Heading`] as HeadingLevel) || headingText
|
|
141
|
+
)
|
|
142
|
+
}
|
|
140
143
|
return acc
|
|
141
144
|
}, {})
|
|
142
145
|
return result
|
|
@@ -243,7 +246,7 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
|
|
|
243
246
|
sections.push({ type: 'streamfield', blocks: keyedCustomSections.value['bottom'] })
|
|
244
247
|
}
|
|
245
248
|
const filteredSections = sections.filter(
|
|
246
|
-
(item) => item.text
|
|
249
|
+
(item) => item.text || item.blocks?.length || item.procedures?.length
|
|
247
250
|
)
|
|
248
251
|
|
|
249
252
|
return filteredSections
|
|
@@ -335,20 +338,18 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
|
|
|
335
338
|
v-for="(value, _key) in consolidatedSections"
|
|
336
339
|
:key="_key"
|
|
337
340
|
>
|
|
338
|
-
<
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
/>
|
|
351
|
-
</template>
|
|
341
|
+
<BlockStreamfield
|
|
342
|
+
v-if="value.type === 'streamfield'"
|
|
343
|
+
:data="value.blocks"
|
|
344
|
+
/>
|
|
345
|
+
<PageEduLessonSection
|
|
346
|
+
v-else
|
|
347
|
+
:heading="value.heading"
|
|
348
|
+
:blocks="value.blocks"
|
|
349
|
+
:procedures="value.procedures"
|
|
350
|
+
:text="value.text"
|
|
351
|
+
:image="value.image"
|
|
352
|
+
/>
|
|
352
353
|
</template>
|
|
353
354
|
|
|
354
355
|
<!-- streamfield blocks -->
|