@explorer-1/vue 0.2.75 → 0.2.77

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.75",
3
+ "version": "0.2.77",
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
  "vue3-compare-image": "^1.2.5",
32
32
  "vue3-observe-visibility": "^1.0.1",
33
- "@explorer-1/common": "1.1.19"
33
+ "@explorer-1/common": "1.1.20"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@vitejs/plugin-vue": "^5.0.4",
@@ -1,7 +1,10 @@
1
1
  <script lang="ts">
2
2
  import { defineComponent } from 'vue'
3
+ import { mapStores } from 'pinia'
4
+ import { useThemeStore } from '../../store/theme'
3
5
  import { eventBus } from './../../utils/eventBus'
4
6
  import MixinAnimationCaret from './../MixinAnimationCaret/MixinAnimationCaret.vue'
7
+ import { isEduExternalLink } from './../../utils/isEduExternalLink'
5
8
 
6
9
  interface Variants {
7
10
  [key: string]: string
@@ -111,6 +114,7 @@ export default defineComponent({
111
114
  },
112
115
  emits: ['linkClicked', 'specificLinkClicked'],
113
116
  computed: {
117
+ ...mapStores(useThemeStore),
114
118
  computedVariants(): Variants {
115
119
  if (this.usePrimaryColor) {
116
120
  return primaryColorVariants
@@ -127,10 +131,27 @@ export default defineComponent({
127
131
  }
128
132
  return classes
129
133
  },
134
+ isEduExternal(): boolean | string {
135
+ if (this.href) {
136
+ return isEduExternalLink(this.href)
137
+ }
138
+ return ''
139
+ },
140
+ isExternal(): boolean {
141
+ if (this.href) {
142
+ if (this.themeStore.isEdu && isEduExternalLink(this.href)) {
143
+ return true
144
+ } else if (!this.themeStore.isEdu) {
145
+ return true
146
+ }
147
+ return false
148
+ }
149
+ return false
150
+ },
130
151
  theTarget(): string | undefined {
131
152
  if (this.target) {
132
153
  return this.target
133
- } else if (this.href && this.externalTargetBlank) {
154
+ } else if (this.isExternal && this.externalTargetBlank) {
134
155
  return '_blank'
135
156
  }
136
157
  return undefined
@@ -105,7 +105,13 @@
105
105
  </span>
106
106
  <span class="sr-only">.</span>
107
107
  </p>
108
- <template v-if="theItem.externalLink">
108
+ <template
109
+ v-if="
110
+ theItem.externalLink &&
111
+ themeStore.isEdu &&
112
+ isEduExternalLink(theItem.externalLink)
113
+ "
114
+ >
109
115
  <IconExternal
110
116
  class="text-primary ml-2"
111
117
  :class="{ 'text-sm mt-1px': small, '-mt-1px': medium, '-mt-.5': large }"
@@ -188,6 +194,7 @@ import { defineComponent } from 'vue'
188
194
  import { mapStores } from 'pinia'
189
195
  import { useThemeStore } from '../../store/theme'
190
196
  import { mixinFormatEventDates } from './../../utils/mixins'
197
+ import { isEduExternalLink } from './../../utils/isEduExternalLink'
191
198
  import type { HeadingLevel } from './../BaseHeading/BaseHeading.vue'
192
199
  import IconArrow from './../Icons/IconArrow.vue'
193
200
  import IconExternal from './../Icons/IconExternal.vue'
@@ -389,6 +396,11 @@ export default defineComponent({
389
396
  )
390
397
  : undefined
391
398
  }
399
+ },
400
+ methods: {
401
+ isEduExternalLink(url: string): boolean {
402
+ return isEduExternalLink(url)
403
+ }
392
404
  }
393
405
  })
394
406
  </script>
@@ -19,13 +19,13 @@ export default {
19
19
  excludeStories: /.*Data$/
20
20
  }
21
21
 
22
- export const RichTextMediaData = `<p data-block-key="5f55p">Description for it.</p><div class="richtext-image fullwidth"><img alt="Perseverance Looks Back at &amp;#x27;Bright Angel&amp;#x27;" height="480" loading="lazy" src="https://picsum.photos/640/480" width="640">
22
+ export const RichTextMediaData = `<h2>A heading in BlockText</h2><p data-block-key="5f55p">Description for it.</p><div class="richtext-image fullwidth"><img alt="Perseverance Looks Back at &amp;#x27;Bright Angel&amp;#x27;" height="480" loading="lazy" src="https://picsum.photos/640/480" width="640">
23
23
  <div class="richtext-caption">
24
24
  <div class="caption">One of the navigation cameras aboard NASAs Perseverance Mars rover captured this view looking back at the Bright Angel area on July 30, 2024.</div>
25
25
  <span class="credit">Credit: NASA/JPL-Caltech</span>
26
26
  <a class="caption-link" href="#">Full Image Details</a>
27
27
  </div>
28
- </div><p data-block-key="89jcq">More text and another image that&#x27;s full width (above)</p><p data-block-key="6jsp"></p><div class="richtext-image left"><img alt="Carbon Mapper Coalition&amp;#x27;s Tanager Satellite" height="336" loading="lazy" src="https://picsum.photos/640/336" width="640">
28
+ </div><h3>Subheading in BlockText</h3><p data-block-key="89jcq">More text and another image that&#x27;s full width (above)</p><p data-block-key="6jsp"></p><div class="richtext-image left"><img alt="Carbon Mapper Coalition&amp;#x27;s Tanager Satellite" height="336" loading="lazy" src="https://picsum.photos/640/336" width="640">
29
29
  <div class="richtext-caption">
30
30
  <div class="caption">This artists concept depicts one of the Carbon Mapper Coalitions Tanager satellites, the first of which launched on Aug. 16, 2024. Tanager-1 will use imaging spectrometer technology developed at JPL to measure greenhouse gas point-source emissions.</div>
31
31
  <span class="credit">Credit: Planet Labs PBC</span>
@@ -10,7 +10,7 @@
10
10
  }"
11
11
  >
12
12
  <div
13
- class="max-w-screen-3xl mx-auto"
13
+ class="w-full mx-auto"
14
14
  :class="{ 'bg-gradient-to-r from-black to-primary bg-transparent to-90% text-white': invert }"
15
15
  >
16
16
  <div
@@ -1,6 +1,7 @@
1
1
  import { BlockRelatedLinksData } from './../../../components/BlockRelatedLinks/BlockRelatedLinks.stories.js'
2
2
  import { BlockLinkCardCarouselData } from './../../../components/BlockLinkCarousel/BlockLinkCarousel.stories.js'
3
3
  import { BlockStreamfieldMinimalData } from './../../../components/BlockStreamfield/BlockStreamfield.stories'
4
+ import { NavSecondaryData } from './../../../components/NavSecondary/NavSecondary.stories.js'
4
5
  import PageEduCollectionsDetail from './PageEduCollectionsDetail.vue'
5
6
 
6
7
  export default {
@@ -102,3 +103,39 @@ export const NoMetaPanel = {
102
103
  }
103
104
  }
104
105
  }
106
+
107
+ export const NoHero = {
108
+ args: {
109
+ data: {
110
+ ...BaseStory.args.data,
111
+ heroImage: undefined
112
+ }
113
+ }
114
+ }
115
+
116
+ export const SecondaryNav = {
117
+ args: {
118
+ data: {
119
+ ...BaseStory.args.data,
120
+ breadcrumb: NavSecondaryData.breadcrumb
121
+ }
122
+ }
123
+ }
124
+ export const SecondaryNavHeroInline = {
125
+ args: {
126
+ data: {
127
+ ...BaseStory.args.data,
128
+ breadcrumb: NavSecondaryData.breadcrumb,
129
+ heroPosition: 'inline'
130
+ }
131
+ }
132
+ }
133
+ export const SecondaryNavNoHero = {
134
+ args: {
135
+ data: {
136
+ ...BaseStory.args.data,
137
+ breadcrumb: NavSecondaryData.breadcrumb,
138
+ heroImage: undefined
139
+ }
140
+ }
141
+ }
@@ -9,6 +9,7 @@ import BlockStreamfield from './../../../components/BlockStreamfield/BlockStream
9
9
  import BlockRelatedLinks from '../../../components/BlockRelatedLinks/BlockRelatedLinks.vue'
10
10
  import HeroLarge from './../../../components/HeroLarge/HeroLarge.vue'
11
11
  import NavJumpMenu from './../../../components/NavJumpMenu/NavJumpMenu.vue'
12
+ import NavSecondary from './../../../components/NavSecondary/NavSecondary.vue'
12
13
  import MetaPanel from '../../../components/MetaPanel/MetaPanel.vue'
13
14
  import ShareButtonsEdu from '../../../components/ShareButtonsEdu/ShareButtonsEdu.vue'
14
15
 
@@ -39,9 +40,9 @@ const heroInline = computed((): boolean => {
39
40
  })
40
41
 
41
42
  const computedClass = computed((): string => {
42
- if (heroInline.value || !data?.heroImage) {
43
+ if ((heroInline.value || !data?.heroImage) && !data?.breadcrumb) {
43
44
  return 'pt-5 lg:pt-12'
44
- } else if (!heroInline.value) {
45
+ } else if (!heroInline.value || data?.breadcrumb) {
45
46
  return '-nav-offset'
46
47
  }
47
48
  return ''
@@ -63,8 +64,16 @@ const computedClass = computed((): string => {
63
64
  :class="!data.showMetaPanel ? 'mb-10' : ''"
64
65
  />
65
66
 
67
+ <!-- secondary nav -->
68
+ <NavSecondary
69
+ v-if="data.breadcrumb"
70
+ class="mb-10"
71
+ :breadcrumb="data.breadcrumb"
72
+ :has-intro="data.heroImage && !heroInline ? true : false"
73
+ />
74
+
66
75
  <NavJumpMenu
67
- v-if="data.showJumpMenu"
76
+ v-if="data.showJumpMenu && !data.breadcrumb"
68
77
  ref="PageEduCollectionsDetailJumpMenu"
69
78
  :title="data.title"
70
79
  :blocks="data.body"
@@ -97,8 +106,8 @@ const computedClass = computed((): string => {
97
106
  :primary-subject="data.primarySubject"
98
107
  :additional-subjects="data.additionalSubjects"
99
108
  :grade-levels="data.gradeLevels"
100
- :negative-top="!heroInline"
101
- :negative-bottom="heroInline"
109
+ :negative-top="!heroInline && !data.breadcrumb && data.heroImage ? true : false"
110
+ :negative-bottom="heroInline && !data.breadcrumb"
102
111
  />
103
112
 
104
113
  <!-- TODO: put this in a component (exclude layout though) -->
@@ -115,7 +124,7 @@ const computedClass = computed((): string => {
115
124
  </LayoutHelper>
116
125
 
117
126
  <LayoutHelper
118
- v-if="!heroInline"
127
+ v-if="!heroInline && data.heroImage"
119
128
  indent="col-2"
120
129
  class="mb-6 lg:mb-12"
121
130
  :class="{ '-mt-4': data.showMetaPanel }"
@@ -208,16 +208,16 @@ const { heading, blocks, image, steps, stepsNumbering, text } = reactive(props)
208
208
  p,
209
209
  li {
210
210
  @screen lg {
211
- @apply mr-[10rem];
211
+ @apply pr-[9rem];
212
212
  }
213
213
  @screen xl {
214
- @apply mr-[14rem];
214
+ @apply pr-[13rem];
215
215
  }
216
216
  }
217
217
  table {
218
218
  p,
219
219
  li {
220
- @apply mr-0;
220
+ @apply pr-0;
221
221
  }
222
222
  }
223
223
  }
@@ -0,0 +1,12 @@
1
+ export const isEduExternalLink = (url: string): boolean => {
2
+ if (
3
+ url &&
4
+ (url.startsWith('/edu/') ||
5
+ url.startsWith('/edubeta/') ||
6
+ url.startsWith('https://www.jpl.nasa.gov/edu/') ||
7
+ url.startsWith('https://jpl.nasa.gov/edu/'))
8
+ ) {
9
+ return false
10
+ }
11
+ return true
12
+ }