@explorer-1/vue 0.2.29 → 0.2.31

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.
@@ -37,7 +37,10 @@ export namespace BaseStory {
37
37
  let additionalSubjects: {
38
38
  subject: string;
39
39
  }[];
40
- let time: string;
40
+ namespace time {
41
+ let time_1: string;
42
+ export { time_1 as time };
43
+ }
41
44
  let gradeLevels: {
42
45
  gradeLevel: string;
43
46
  }[];
@@ -13,10 +13,12 @@ export namespace MetadataEventData {
13
13
  export let location: string;
14
14
  export let startDate: string;
15
15
  export let startDatetime: string;
16
+ export let startTime: string;
16
17
  export let endDate: string;
18
+ export let endDatetime: string;
19
+ export let endTime: string;
17
20
  export let ongoing: boolean;
18
21
  export let isVirtualEvent: boolean;
19
- export let endDatetime: string;
20
22
  export let locationName: string;
21
23
  export let locationLink: string;
22
24
  export let customDate: undefined;
@@ -16,6 +16,10 @@ declare const _default: import('vue').DefineComponent<{
16
16
  required: false;
17
17
  default: boolean;
18
18
  };
19
+ jumpMenu: {
20
+ type: BooleanConstructor;
21
+ default: boolean;
22
+ };
19
23
  }, unknown, {
20
24
  isSticky: boolean;
21
25
  stickyElement?: HTMLElement | undefined;
@@ -58,9 +62,14 @@ declare const _default: import('vue').DefineComponent<{
58
62
  required: false;
59
63
  default: boolean;
60
64
  };
65
+ jumpMenu: {
66
+ type: BooleanConstructor;
67
+ default: boolean;
68
+ };
61
69
  }>>, {
62
70
  invert: boolean;
63
71
  breadcrumb: string;
64
72
  hasIntro: boolean;
73
+ jumpMenu: boolean;
65
74
  }, {}>;
66
75
  export default _default;
@@ -206,6 +206,7 @@ export interface PageObject {
206
206
  slug: string;
207
207
  url: string;
208
208
  title: string;
209
+ readTime?: string;
209
210
  getTopicsForDisplay?: Topic[];
210
211
  showJumpMenu?: boolean;
211
212
  label?: string;
@@ -54,6 +54,7 @@ export namespace BaseStory {
54
54
  let alt_1: string;
55
55
  export { alt_1 as alt };
56
56
  }
57
+ export let heroSummary: string;
57
58
  export let heroImageCaption: string;
58
59
  export let heroConstrain: boolean;
59
60
  export let heroPosition: string;
@@ -1,5 +1,6 @@
1
1
  import { default as PageEduExplainerArticle } from './PageEduExplainerArticle.vue';
2
2
  import { BlockLinkCardCarouselData } from './../../../components/BlockLinkCarousel/BlockLinkCarousel.stories.js';
3
+ import { AboutTheAuthorData } from './../../../components/AboutTheAuthor/AboutTheAuthor.stories';
3
4
  declare namespace _default {
4
5
  export let title: string;
5
6
  export { PageEduExplainerArticle as component };
@@ -169,6 +170,8 @@ export namespace BaseStory {
169
170
  let title_1: string;
170
171
  export { title_1 as title };
171
172
  export let readTime: string;
173
+ export let lastPublishedAt: string;
174
+ export { AboutTheAuthorData as authors };
172
175
  export let heroConstrain: boolean;
173
176
  export let heroPosition: string;
174
177
  export let hero: {
@@ -167,14 +167,26 @@ export namespace BaseStory {
167
167
  value: string;
168
168
  }[];
169
169
  export let backgroundHeading: string;
170
- export let procedures: {
171
- blocks: {
172
- blockType: string;
173
- value: string;
170
+ export let procedures: ({
171
+ sectionHeading: string;
172
+ stepsNumbering: boolean;
173
+ steps: {
174
+ blocks: {
175
+ blockType: string;
176
+ value: string;
177
+ }[];
174
178
  }[];
175
- }[];
179
+ } | {
180
+ stepsNumbering: boolean;
181
+ steps: {
182
+ blocks: {
183
+ blockType: string;
184
+ value: string;
185
+ }[];
186
+ }[];
187
+ sectionHeading?: undefined;
188
+ })[];
176
189
  export let proceduresHeading: string;
177
- export let proceduresStepsNumbering: boolean;
178
190
  export let discussion: {
179
191
  blockType: string;
180
192
  value: string;
@@ -27,6 +27,7 @@ export namespace BaseStory {
27
27
  export let url: string;
28
28
  export let pageType: string;
29
29
  export let contentType: string;
30
+ export let readTime: string;
30
31
  export let showJumpMenu: boolean;
31
32
  export namespace thumbnailImage {
32
33
  let __typename_1: string;
@@ -1,3 +1,3 @@
1
1
  import { GradeLevelsObject } from './../interfaces';
2
2
 
3
- export declare const rangeifyGrades: (gradeLevels: GradeLevelsObject[]) => string | undefined;
3
+ export declare const rangeifyGrades: (gradeLevels: GradeLevelsObject[], showLabel?: boolean) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -246,14 +246,17 @@ export default defineComponent({
246
246
  // to determine active class on menu links and 'more' menu links
247
247
  checkActive(item: LinkObject) {
248
248
  const urlKey = this.getUrlKey(item)
249
- if (urlKey && this.breadcrumb && this.breadcrumb.menu_links) {
249
+ if (urlKey && this.breadcrumb?.menu_links) {
250
250
  // key into the breadcrumbs for each section
251
- const objArray = this.breadcrumb.menu_links[urlKey]
251
+ const sectionLinks = this.breadcrumb.menu_links[urlKey]
252
252
  // check if any of the paths contained in the array are active
253
- const isActive = objArray.some((el: BreadcrumbPathObject) => mixinIsActivePath(el.path))
253
+ const isActive = sectionLinks.some((link: BreadcrumbPathObject) =>
254
+ mixinIsActivePath(link.path)
255
+ )
254
256
  if (isActive) {
255
- mixinUpdateGlobalChildren(this.breadcrumb.menu_links[urlKey])
257
+ mixinUpdateGlobalChildren(sectionLinks)
256
258
  }
259
+ console.log(isActive)
257
260
  return isActive
258
261
  }
259
262
  return false
@@ -5,6 +5,7 @@
5
5
  ref="NavJumpMenuRef"
6
6
  class="NavJumpMenu -hide-until-threshold"
7
7
  :invert="invert"
8
+ jump-menu
8
9
  >
9
10
  <template v-for="(item, index) in theBreadcrumbs">
10
11
  <template v-if="item.children && item.children.length > 0">
@@ -79,6 +79,10 @@ export default defineComponent({
79
79
  type: Boolean,
80
80
  required: false,
81
81
  default: false
82
+ },
83
+ jumpMenu: {
84
+ type: Boolean,
85
+ default: false
82
86
  }
83
87
  },
84
88
  data(): {
@@ -101,9 +105,12 @@ export default defineComponent({
101
105
  if (this.breadcrumb) {
102
106
  // we also want to update the store to override secondary nav
103
107
  mixinUpdateSecondary(JSON.parse(this.breadcrumb))
108
+
104
109
  return JSON.parse(this.breadcrumb)
105
110
  } else if (this.headerStore) {
106
- return this.headerStore.globalChildren
111
+ if (!this.jumpMenu) {
112
+ return this.headerStore.globalChildren
113
+ }
107
114
  }
108
115
  return undefined
109
116
  },
@@ -117,7 +124,9 @@ export default defineComponent({
117
124
  mounted() {
118
125
  if (this.enabled) {
119
126
  // if there is a secondary nav displayed, then don't highlight the primary active item
120
- mixinHighlightPrimary(false)
127
+ if (!this.jumpMenu) {
128
+ mixinHighlightPrimary(false)
129
+ }
121
130
  }
122
131
 
123
132
  if (
@@ -54,6 +54,7 @@ export const BaseStory = {
54
54
  },
55
55
  alt: 'The alt text'
56
56
  },
57
+ heroSummary: 'Lorem ipsum dolor sit amet consectatur adipscing.',
57
58
  heroImageCaption: '<p>Lorem ipsum dolor sit amet</p>',
58
59
  heroConstrain: true,
59
60
  heroPosition: 'full_bleed',
@@ -10,12 +10,13 @@ import BlockRelatedLinks from '../../../components/BlockRelatedLinks/BlockRelate
10
10
  import HeroLarge from './../../../components/HeroLarge/HeroLarge.vue'
11
11
  import NavJumpMenu from './../../../components/NavJumpMenu/NavJumpMenu.vue'
12
12
  import MetaPanel from '../../../components/MetaPanel/MetaPanel.vue'
13
+ import ShareButtonsEdu from '../../../components/ShareButtonsEdu/ShareButtonsEdu.vue'
13
14
 
14
15
  interface PageEduCollectionsDetail extends PageEduResourcesObject {
15
16
  heroImage: ImageObject
16
17
  heroImageCaption: string
17
18
  showMetaPanel: boolean
18
- heroSubtitle: string
19
+ heroSummary: string
19
20
  }
20
21
  interface PageEduCollectionsDetailProps {
21
22
  data?: PageEduCollectionsDetail
@@ -57,9 +58,9 @@ const computedClass = computed((): string => {
57
58
  v-if="!heroInline && data.heroImage"
58
59
  :title="data.title"
59
60
  :image="data.heroImage"
60
- :summary="'Test test test lorem ipsum dolor sit amet yep.'"
61
+ :summary="data.heroSummary"
61
62
  :custom-pill-type="data.__typename"
62
- :class="!data.showMetaPanel ? 'mb-10 lg:mb-22' : ''"
63
+ :class="!data.showMetaPanel ? 'mb-10' : ''"
63
64
  />
64
65
 
65
66
  <NavJumpMenu
@@ -81,11 +82,18 @@ const computedClass = computed((): string => {
81
82
  pill
82
83
  pill-color="primary-inverted"
83
84
  />
85
+
86
+ <ShareButtonsEdu
87
+ class="mt-4"
88
+ :title="data.title"
89
+ :url="data.url"
90
+ />
84
91
  </LayoutHelper>
92
+
85
93
  <MetaPanel
86
94
  v-if="data.showMetaPanel"
87
95
  theme="primary"
88
- :class="{ 'mb-10 lg:mb-14': true }"
96
+ :class="{ 'mb-10 lg:mb-12': true }"
89
97
  :primary-subject="data.primarySubject"
90
98
  :additional-subjects="data.additionalSubjects"
91
99
  :grade-levels="data.gradeLevels"
@@ -96,7 +104,7 @@ const computedClass = computed((): string => {
96
104
  <!-- TODO: put this in a component (exclude layout though) -->
97
105
  <LayoutHelper
98
106
  v-if="data.heroImage && heroInline"
99
- class="lg:mb-22 mb-10"
107
+ class="mb-10 lg:mb-18"
100
108
  >
101
109
  <BlockImageStandard
102
110
  :data="data.heroImage"
@@ -106,6 +114,19 @@ const computedClass = computed((): string => {
106
114
  />
107
115
  </LayoutHelper>
108
116
 
117
+ <LayoutHelper
118
+ v-if="!heroInline"
119
+ indent="col-2"
120
+ class="mb-6 lg:mb-12"
121
+ :class="{ '-mt-4': data.showMetaPanel }"
122
+ >
123
+ <ShareButtonsEdu
124
+ class="mt-4"
125
+ :title="data.title"
126
+ :url="data.url"
127
+ />
128
+ </LayoutHelper>
129
+
109
130
  <!-- streamfield blocks -->
110
131
  <BlockStreamfield :data="data.body" />
111
132
 
@@ -169,17 +169,52 @@ export const BaseStory = {
169
169
 
170
170
  procedures: [
171
171
  {
172
- blocks: BlockStreamfieldMinimalData.body
172
+ sectionHeading: 'Section Heading 1',
173
+ stepsNumbering: true,
174
+ steps: [
175
+ {
176
+ blocks: BlockStreamfieldMinimalData.body
177
+ },
178
+ {
179
+ blocks: BlockStreamfieldMinimalData.body
180
+ },
181
+ {
182
+ blocks: BlockStreamfieldMinimalData.body
183
+ }
184
+ ]
173
185
  },
174
186
  {
175
- blocks: BlockStreamfieldMinimalData.body
187
+ // sectionHeading: 'Section Heading 2',
188
+ stepsNumbering: true,
189
+ steps: [
190
+ {
191
+ blocks: BlockStreamfieldMinimalData.body
192
+ },
193
+ {
194
+ blocks: BlockStreamfieldMinimalData.body
195
+ },
196
+ {
197
+ blocks: BlockStreamfieldMinimalData.body
198
+ }
199
+ ]
176
200
  },
177
201
  {
178
- blocks: BlockStreamfieldMinimalData.body
202
+ sectionHeading: 'Section Heading 3',
203
+ stepsNumbering: false,
204
+ steps: [
205
+ {
206
+ blocks: BlockStreamfieldMinimalData.body
207
+ },
208
+ {
209
+ blocks: BlockStreamfieldMinimalData.body
210
+ },
211
+ {
212
+ blocks: BlockStreamfieldMinimalData.body
213
+ }
214
+ ]
179
215
  }
180
216
  ],
181
217
  proceduresHeading: 'Procedures heading',
182
- proceduresStepsNumbering: true,
183
218
 
184
219
  discussion: BlockStreamfieldMinimalData.body,
185
220
  discussionHeading: 'Discussion heading',
@@ -342,7 +342,6 @@ const consolidatedSections = computed((): EduLessonSectionObject[] => {
342
342
  :heading="value.heading"
343
343
  :blocks="value.blocks"
344
344
  :procedures="value.procedures"
345
- :procedure-steps="value.procedureSteps"
346
345
  :text="value.text"
347
346
  :image="value.image"
348
347
  />
@@ -15,9 +15,12 @@ export interface PageEduLessonSectionProps {
15
15
  heading: BlockHeadingObject
16
16
  blocks?: StreamfieldBlockData[]
17
17
  procedures?: {
18
- blocks: StreamfieldBlockData[]
18
+ sectionHeading: string
19
+ stepsNumbering: boolean
20
+ steps: {
21
+ blocks: StreamfieldBlockData[]
22
+ }[]
19
23
  }[]
20
- procedureSteps?: boolean
21
24
  text?: string
22
25
  image?: ImageObject
23
26
  }
@@ -26,7 +29,6 @@ const props = withDefaults(defineProps<PageEduLessonSectionProps>(), {
26
29
  heading: undefined,
27
30
  blocks: undefined,
28
31
  procedures: undefined,
29
- procedureSteps: false,
30
32
  text: undefined,
31
33
  image: undefined
32
34
  })
@@ -68,23 +70,51 @@ const anchorId = computed(() => {
68
70
  />
69
71
  <template v-else-if="procedures?.length">
70
72
  <template
71
- v-for="(item, index) in procedures"
72
- :key="index"
73
+ v-for="(section, _index) in procedures"
74
+ :key="_index"
73
75
  >
74
- <LayoutHelper
75
- v-if="procedureSteps"
76
- indent="col-3"
77
- class="lg:mb-8 mb-5"
78
- >
79
- <BaseHeading level="h3">
80
- {{ 'Section ' + (Number(index) + 1) }}
81
- </BaseHeading>
82
- </LayoutHelper>
83
76
  <div class="PageEduProcedureSection">
84
- <BlockStreamfield
85
- v-if="item?.blocks"
86
- :data="item.blocks"
87
- />
77
+ <LayoutHelper
78
+ v-if="section.sectionHeading"
79
+ indent="col-3"
80
+ class="lg:mb-8 mb-5"
81
+ >
82
+ <BaseHeading level="h3">
83
+ {{ section.sectionHeading }}
84
+ </BaseHeading>
85
+ </LayoutHelper>
86
+ <div
87
+ v-if="section.steps?.length"
88
+ class="PageEduProcedureSectionSteps"
89
+ >
90
+ <template v-if="section.stepsNumbering">
91
+ <ol class="PageEduProcedureSectionSingleStep">
92
+ <template
93
+ v-for="(step, _step_index) of section.steps"
94
+ :key="_step_index"
95
+ >
96
+ <li v-if="step.blocks?.length">
97
+ <BlockStreamfield
98
+ v-if="step?.blocks"
99
+ :data="step.blocks"
100
+ />
101
+ </li>
102
+ </template>
103
+ </ol>
104
+ </template>
105
+ <template v-else>
106
+ <template
107
+ v-for="(step, _step_index) of section.steps"
108
+ :key="_step_index"
109
+ >
110
+ <BlockStreamfield
111
+ v-if="step.blocks?.length"
112
+ class="PageEduProcedureSectionSingleStep"
113
+ :data="step.blocks"
114
+ />
115
+ </template>
116
+ </template>
117
+ </div>
88
118
  </div>
89
119
  </template>
90
120
  </template>
@@ -98,23 +128,55 @@ const anchorId = computed(() => {
98
128
  </section>
99
129
  </template>
100
130
  <style lang="scss">
131
+ @use 'sass:math';
132
+ @function pxToRem($pxValue) {
133
+ // Assumes font-size for body element is a constant 16px
134
+ @return math.div($pxValue, 16) * 1rem;
135
+ }
101
136
  .PageEduProcedureSection {
102
- counter-reset: listitem;
103
- .BlockText ol {
104
- list-style-type: none;
105
- counter-reset: nestedlistitem;
137
+ .PageEduProcedureSectionSteps {
138
+ counter-reset: step;
139
+ }
140
+ .PageEduProcedureSectionSingleStep {
141
+ li:not(:last-of-type) .BlockStreamfield {
142
+ @apply -mb-5 lg:-mb-10;
143
+ }
144
+ }
145
+ ol.PageEduProcedureSectionSingleStep {
146
+ @apply list-none;
106
147
  > li {
107
- counter-increment: listitem;
108
- &::marker {
109
- content: counter(listitem) '. ';
148
+ @apply relative w-full;
149
+ counter-increment: step;
150
+ &::before {
151
+ @apply relative block w-[45rem] mx-auto h-0 pl-3;
152
+ content: counter(step) '. ';
153
+ // mimicking .text-body-lg
154
+ font-size: pxToRem(18);
155
+ line-height: 1.6667;
110
156
  }
111
- }
112
- ol {
113
- list-style-type: none;
114
- > li {
115
- counter-increment: nestedlistitem;
116
- &::marker {
117
- content: counter(nestedlistitem) '. ';
157
+
158
+ @screen sm {
159
+ &::before {
160
+ @apply w-[47rem];
161
+ font-size: pxToRem(19);
162
+ }
163
+ }
164
+ @screen md {
165
+ &::before {
166
+ @apply w-[50rem];
167
+ font-size: pxToRem(20);
168
+ }
169
+ }
170
+ @screen lg {
171
+ &::before {
172
+ @apply w-[47rem] pl-0;
173
+ font-size: pxToRem(21);
174
+ }
175
+ }
176
+ @screen xl {
177
+ &::before {
178
+ @apply w-[59rem];
179
+ font-size: pxToRem(22);
118
180
  }
119
181
  }
120
182
  }
@@ -149,12 +149,16 @@ export const mixinHighlightPrimary = (value: boolean) => {
149
149
  */
150
150
  export const mixinIsActivePath = (itemPath: string): Boolean => {
151
151
  const route = useRoute()
152
- const currentPath = route ? route.path : null
153
- const path = itemPath
154
- const ancestorPath = path ? (path.endsWith('/') ? path : path + '/') : null
152
+ const currentPath = route ? route.path : false
153
+ const path = itemPath.startsWith('http') ? itemPath.replace(/^.*\/\/[^/]+/, '') : itemPath
154
+ const ancestorPath = path ? (path.endsWith('/') ? path : path + '/') : false
155
+
155
156
  if (currentPath && path && ancestorPath) {
156
157
  if (currentPath === path) {
157
158
  return true
159
+ } else if (currentPath.startsWith('/edu/events')) {
160
+ // special treatment since EDU combines News & Events in the main nav
161
+ return path.startsWith('/edu/news')
158
162
  } else {
159
163
  return currentPath.startsWith(ancestorPath)
160
164
  }