@explorer-1/vue 0.2.95 → 0.2.98

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @explorer-1/vue
2
2
 
3
+ ## 0.2.97
4
+
5
+ ### Patch Changes
6
+
7
+ - 039afc4: Adding logic to show/hide share links on content pages
8
+ - 232c7b4: Adding option to autoplay/loop video.
9
+
10
+ ## 0.2.96
11
+
12
+ ### Patch Changes
13
+
14
+ - 2735223: Fixing link logic in HomepageTeaserBlock
15
+
3
16
  ## 0.2.95
4
17
 
5
18
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.95",
3
+ "version": "0.2.98",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,7 +14,7 @@
14
14
  :muted="autoplay"
15
15
  :playsinline="autoplay"
16
16
  :autoplay="autoplay"
17
- :controls="!autoplay"
17
+ controls
18
18
  >
19
19
  <template v-if="data.fileWebm">
20
20
  <source
@@ -13,7 +13,8 @@ export const BlockVideoData = {
13
13
  blockType: 'VideoBlock',
14
14
  video: BaseVideoData,
15
15
  caption: 'Lorem ipsum dolor sit amet consectatur',
16
- credit: 'Credit'
16
+ credit: 'Credit',
17
+ autoplay: false
17
18
  }
18
19
  }
19
20
 
@@ -5,7 +5,7 @@
5
5
  >
6
6
  <BaseVideo
7
7
  :data="data.video"
8
- :autoplay="autoplay"
8
+ :autoplay="data.autoplay"
9
9
  />
10
10
 
11
11
  <div
@@ -78,11 +78,11 @@ export default defineComponent({
78
78
  // image object includes the image caption and credit
79
79
  image: {
80
80
  type: Object,
81
- required: false
81
+ default: undefined
82
82
  },
83
83
  video: {
84
84
  type: Object,
85
- required: false
85
+ default: undefined
86
86
  },
87
87
  // if a caption should even be visible
88
88
  displayCaption: {
@@ -92,11 +92,11 @@ export default defineComponent({
92
92
  // for video heroes that pass separate caption and credit data
93
93
  caption: {
94
94
  type: String,
95
- required: false
95
+ default: undefined
96
96
  },
97
97
  credit: {
98
98
  type: String,
99
- required: false
99
+ default: undefined
100
100
  }
101
101
  },
102
102
  data() {
@@ -33,14 +33,14 @@
33
33
  class="lg:pr-14"
34
34
  :text="data.paragraph"
35
35
  />
36
- <template v-if="data.link && theLink">
36
+ <template v-if="data.link || theExternalLink">
37
37
  <BaseLink
38
38
  variant="primary"
39
39
  class="mt-5"
40
40
  link-class="inline-block"
41
41
  caret-wrapper-class="py-2"
42
- :href="theLink"
43
- :to="data.link.page ? data.link.page.url : null"
42
+ :href="theExternalLink"
43
+ :to="data.link.page ? data.link.page.url : undefined"
44
44
  external-target-blank
45
45
  >
46
46
  {{ data.link.text }}
@@ -60,13 +60,13 @@
60
60
  v-if="theCard.image"
61
61
  class="relative h-auto"
62
62
  >
63
- <template v-if="theCard.link && theLink">
63
+ <template v-if="theCard.link || theCardExternalLink">
64
64
  <BaseLink
65
65
  variant="none"
66
66
  link-class="block"
67
67
  :aria-label="theCard.link.text || 'Learn more'"
68
- :href="theLink"
69
- :to="theCard.link.page ? theCard.link.page.url : null"
68
+ :href="theCardExternalLink"
69
+ :to="theCard.link.page?.url || undefined"
70
70
  external-target-blank
71
71
  >
72
72
  <HomepageTeaserBlockCardImage :data="theCard" />
@@ -87,14 +87,14 @@
87
87
  {{ theCard.description }}
88
88
  </p>
89
89
 
90
- <template v-if="theCard.link && theLink">
90
+ <template v-if="theCard.link || theCardExternalLink">
91
91
  <BaseLink
92
92
  variant="primary"
93
93
  class="mt-3"
94
94
  link-class="inline-block"
95
95
  caret-wrapper-class="py-2"
96
- :href="theLink"
97
- :to="theCard.link.page ? theCard.link.page.url : null"
96
+ :href="theCardExternalLink"
97
+ :to="theCard.link.page ? theCard.link.page.url : undefined"
98
98
  external-target-blank
99
99
  >
100
100
  {{ theCard.link.text }}
@@ -135,11 +135,11 @@ export default defineComponent({
135
135
  }
136
136
  },
137
137
  computed: {
138
- theCard(): object | null {
139
- if (this.data.card && this.data.card.length > 0) {
140
- return this.data.card[0]
138
+ theCard(): object | undefined {
139
+ if (this.data?.card && this.data.card.length > 0) {
140
+ return this.data?.card[0]
141
141
  }
142
- return null
142
+ return undefined
143
143
  },
144
144
  hasCoverImage(): boolean {
145
145
  if (this.data.coverImage && this.data.coverImage.src) {
@@ -147,8 +147,11 @@ export default defineComponent({
147
147
  }
148
148
  return false
149
149
  },
150
- theLink() {
151
- return mixinGetExternalLink(this.data.link) || undefined
150
+ theExternalLink() {
151
+ return mixinGetExternalLink(this.data?.link) || undefined
152
+ },
153
+ theCardExternalLink() {
154
+ return mixinGetExternalLink(this.theCard?.link) || undefined
152
155
  },
153
156
  theSrcSet() {
154
157
  return this.data.coverImage
@@ -4,7 +4,14 @@ import MixinVideoBg from './MixinVideoBg.vue'
4
4
  export default {
5
5
  title: 'Mixins/MixinVideoBg',
6
6
  component: MixinVideoBg,
7
- excludeStories: /.*Data$/
7
+ excludeStories: /.*Data$/,
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: 'This mix-in will always autoplay and loop a video.'
12
+ }
13
+ }
14
+ }
8
15
  }
9
16
 
10
17
  export const BaseStory = {
@@ -5,6 +5,7 @@
5
5
  muted
6
6
  playsinline
7
7
  autoplay
8
+ controls
8
9
  preload="auto"
9
10
  class="object-cover w-full h-full"
10
11
  >
@@ -32,7 +33,11 @@ export default defineComponent({
32
33
  props: {
33
34
  video: {
34
35
  type: Object,
35
- required: false
36
+ default: undefined
37
+ },
38
+ autoplay: {
39
+ type: Boolean,
40
+ default: false
36
41
  }
37
42
  }
38
43
  })
@@ -28,6 +28,7 @@ export const ContentPageData = {
28
28
  breadcrumb: NavSecondaryData.breadcrumb,
29
29
  title: 'Make a Paper Mars Helicopter',
30
30
  displayLabel: 'Classroom Activity',
31
+ showShareLinks: true,
31
32
  heroPosition: 'inline',
32
33
  heroImage: HeroMediaData.image,
33
34
  heroImageInline: HeroMediaData.imageInline,
@@ -87,3 +88,11 @@ export const BaseStory = {
87
88
  data: ContentPageData
88
89
  }
89
90
  }
91
+ export const NoShareLinks = {
92
+ args: {
93
+ data: {
94
+ ...ContentPageData,
95
+ showShareLinks: false
96
+ }
97
+ }
98
+ }
@@ -144,7 +144,7 @@ export default defineComponent({
144
144
  class="lg:mb-0 relative mb-8"
145
145
  >
146
146
  <ShareButtons
147
- v-if="data.title && data.url && !themeStore.isEdu"
147
+ v-if="data.showShareLinks && data.title && data.url && !themeStore.isEdu"
148
148
  :title="data.title"
149
149
  :url="data.url"
150
150
  />
@@ -22,6 +22,7 @@
22
22
  class="md:mb-12 lg:mb-18 mb-10"
23
23
  :image="data.hero[0].image"
24
24
  :video="data.hero[0].video"
25
+ :autoplay="data.hero[0].autoplay"
25
26
  :display-caption="data.hero[0].displayCaption"
26
27
  :caption="data.hero[0].caption"
27
28
  :credit="data.hero[0].credit"
@@ -217,9 +217,9 @@ export const mixinGetSrcSet = (srcSetObject: Partial<ImageObject>): string => {
217
217
  }
218
218
  // Use with RelatedLinkBlock to retrieve the external link to use with an href prop
219
219
  export const mixinGetExternalLink = (link: RelatedLinkObject): string | undefined => {
220
- if (link.externalLink) {
220
+ if (link?.externalLink) {
221
221
  return link.externalLink
222
- } else if (link.document) {
222
+ } else if (link?.document) {
223
223
  return link.document.url
224
224
  }
225
225
  return undefined