@explorer-1/vue 0.2.20 → 0.2.22
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/BaseImageCaption/BaseImageCaption.vue +16 -0
- package/src/components/BaseTimer/BaseTimer.vue +1 -5
- package/src/components/BlockCardGrid/BlockCardGrid.vue +1 -1
- package/src/components/BlockGist/BlockGist.stories.js +2 -3
- package/src/components/BlockGist/BlockGist.vue +11 -38
- package/src/components/BlockStreamfield/BlockStreamfield.stories.js +7 -0
- package/src/components/BlockStreamfield/BlockStreamfield.vue +4 -5
- package/src/components/BlockTeaser/BlockTeaser.vue +20 -17
- package/src/components/NavDesktop/NavDesktop.stories.js +2 -6
- package/src/components/NavHeading/NavHeading.vue +1 -1
- package/src/components/NavLinkList/NavLinkList.stories.js +1 -1
- package/src/components/TheFooter/TheFooter.vue +1 -1
- package/src/templates/edu/PageEduExplainerArticle/PageEduExplainerArticle.stories.js +3 -1
- package/src/templates/edu/PageEduExplainerArticle/PageEduExplainerArticle.vue +8 -7
- package/src/utils/dayjs.js +5 -1
package/package.json
CHANGED
|
@@ -14,6 +14,14 @@ export default defineComponent({
|
|
|
14
14
|
type: Object as PropType<Partial<ImageObject>>,
|
|
15
15
|
required: true,
|
|
16
16
|
default: undefined
|
|
17
|
+
},
|
|
18
|
+
customLink: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: undefined
|
|
21
|
+
},
|
|
22
|
+
customLinkText: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'Custom Link'
|
|
17
25
|
}
|
|
18
26
|
}
|
|
19
27
|
})
|
|
@@ -43,6 +51,14 @@ export default defineComponent({
|
|
|
43
51
|
>
|
|
44
52
|
Full Image Details
|
|
45
53
|
</BaseLink>
|
|
54
|
+
<BaseLink
|
|
55
|
+
v-else-if="customLink"
|
|
56
|
+
class="inline-block"
|
|
57
|
+
variant="default"
|
|
58
|
+
:to="customLink"
|
|
59
|
+
>
|
|
60
|
+
{{ customLinkText }}
|
|
61
|
+
</BaseLink>
|
|
46
62
|
</div>
|
|
47
63
|
</template>
|
|
48
64
|
|
|
@@ -52,11 +52,7 @@
|
|
|
52
52
|
import type { PropType } from 'vue'
|
|
53
53
|
import { defineComponent } from 'vue'
|
|
54
54
|
import dayjs, { type Dayjs } from 'dayjs'
|
|
55
|
-
import
|
|
56
|
-
import minMax from 'dayjs/plugin/minMax.js'
|
|
57
|
-
|
|
58
|
-
dayjs.extend(duration)
|
|
59
|
-
dayjs.extend(minMax)
|
|
55
|
+
import { type Duration } from 'dayjs/plugin/duration.js'
|
|
60
56
|
|
|
61
57
|
const calculateDuration = (start: Dayjs): Duration | undefined => {
|
|
62
58
|
// Use round seconds so the datetime string stays valid and can be read by screen readers.
|
|
@@ -8,10 +8,9 @@ export default {
|
|
|
8
8
|
|
|
9
9
|
export const BlockGistData = {
|
|
10
10
|
blockType: 'GitHubGistBlock',
|
|
11
|
-
caption:
|
|
12
|
-
'<p data-block-key="a7ves">The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.</p>',
|
|
11
|
+
caption: '<p>Caption for gist block</p>',
|
|
13
12
|
id: 'cefc8e20-2833-4d0b-a4d6-7f469d5dbd02',
|
|
14
|
-
url: 'https://gist.github.com/
|
|
13
|
+
url: 'https://gist.github.com/nasajpledu/acb1a3f04895a9905570b267193d42ac'
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
// stories
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { ref, watch } from 'vue'
|
|
3
|
+
import BaseImageCaption from './../BaseImageCaption/BaseImageCaption.vue'
|
|
3
4
|
import GitHub404 from './GitHub404.vue'
|
|
4
5
|
interface BlockGistProps {
|
|
5
6
|
data: {
|
|
@@ -46,7 +47,7 @@ watch(
|
|
|
46
47
|
<GitHub404 />
|
|
47
48
|
</template>
|
|
48
49
|
<template v-else-if="gistUrl">
|
|
49
|
-
<div class="
|
|
50
|
+
<div class="relative">
|
|
50
51
|
<div
|
|
51
52
|
id="iframe-description"
|
|
52
53
|
class="sr-only"
|
|
@@ -79,7 +80,6 @@ watch(
|
|
|
79
80
|
ref="frame"
|
|
80
81
|
:src="gistUrl"
|
|
81
82
|
:class="{ loaded }"
|
|
82
|
-
class="md:min-h-[313px] lg:min-h-[613px]"
|
|
83
83
|
width="100%"
|
|
84
84
|
frameborder="0"
|
|
85
85
|
title="Code snippet display"
|
|
@@ -87,17 +87,15 @@ watch(
|
|
|
87
87
|
aria-describedby="iframe-description"
|
|
88
88
|
aria-hidden="false"
|
|
89
89
|
></iframe>
|
|
90
|
-
<div
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{{ 'View on GitHub' }}
|
|
100
|
-
</nuxt-link>
|
|
90
|
+
<div
|
|
91
|
+
v-if="data.caption"
|
|
92
|
+
class="py-4"
|
|
93
|
+
>
|
|
94
|
+
<BaseImageCaption
|
|
95
|
+
:data="data"
|
|
96
|
+
:custom-link="props.data.url"
|
|
97
|
+
custom-link-text="View on GitHub"
|
|
98
|
+
/>
|
|
101
99
|
</div>
|
|
102
100
|
</div>
|
|
103
101
|
</template>
|
|
@@ -106,8 +104,6 @@ watch(
|
|
|
106
104
|
|
|
107
105
|
<style scoped lang="scss">
|
|
108
106
|
.BlockGist {
|
|
109
|
-
margin: 2rem 0;
|
|
110
|
-
|
|
111
107
|
.GitHubIcon {
|
|
112
108
|
@apply h-5 pb-0.5 flex flex-row items-baseline flex-grow-0;
|
|
113
109
|
}
|
|
@@ -115,31 +111,12 @@ watch(
|
|
|
115
111
|
iframe {
|
|
116
112
|
@apply border border-gray-light-mid border-t-8 rounded-none;
|
|
117
113
|
}
|
|
118
|
-
|
|
119
|
-
.gist-caption {
|
|
120
|
-
@apply text-sm font-medium m-1 flex-wrap;
|
|
121
|
-
|
|
122
|
-
span {
|
|
123
|
-
p {
|
|
124
|
-
@apply text-gray-mid;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
a {
|
|
129
|
-
@apply underline text-action can-hover:hover:text-action-dark cursor-pointer;
|
|
130
|
-
white-space: nowrap; /* Prevents the link from wrapping onto a new line */
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
114
|
}
|
|
134
115
|
body.ThemeVariantLight {
|
|
135
116
|
.BlockGist {
|
|
136
117
|
iframe {
|
|
137
118
|
@apply border-gray-light-mid;
|
|
138
119
|
}
|
|
139
|
-
|
|
140
|
-
.gist-caption {
|
|
141
|
-
@apply text-gray-mid-dark;
|
|
142
|
-
}
|
|
143
120
|
}
|
|
144
121
|
}
|
|
145
122
|
|
|
@@ -148,10 +125,6 @@ body.ThemeVariantDark {
|
|
|
148
125
|
iframe {
|
|
149
126
|
@apply border-gray-mid-dark bg-gray-light;
|
|
150
127
|
}
|
|
151
|
-
|
|
152
|
-
.gist-caption {
|
|
153
|
-
@apply text-gray-light-mid;
|
|
154
|
-
}
|
|
155
128
|
}
|
|
156
129
|
}
|
|
157
130
|
</style>
|
|
@@ -20,6 +20,7 @@ import BlockStreamfield, { variants } from './BlockStreamfield.vue'
|
|
|
20
20
|
export default {
|
|
21
21
|
title: 'Components/Blocks/BlockStreamfield',
|
|
22
22
|
component: BlockStreamfield,
|
|
23
|
+
tags: ['!autodocs'],
|
|
23
24
|
argTypes: {
|
|
24
25
|
variant: {
|
|
25
26
|
control: { type: 'select' },
|
|
@@ -90,6 +91,12 @@ export const BlockStreamfieldData = {
|
|
|
90
91
|
heading: 'Heading 3',
|
|
91
92
|
level: 'h3'
|
|
92
93
|
},
|
|
94
|
+
{
|
|
95
|
+
blockType: 'GitHubGistBlock',
|
|
96
|
+
caption: '<p>Caption for gist block</p>',
|
|
97
|
+
id: 'cefc8e20-2833-4d0b-a4d6-7f469d5dbd02',
|
|
98
|
+
url: 'https://gist.github.com/nasajpledu/acb1a3f04895a9905570b267193d42ac'
|
|
99
|
+
},
|
|
93
100
|
{
|
|
94
101
|
blockType: 'RichTextBlock',
|
|
95
102
|
value:
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
<LayoutHelper
|
|
170
170
|
v-else-if="block.blockType == 'GitHubGistBlock'"
|
|
171
171
|
:key="`GitHubGistBlock${index}`"
|
|
172
|
-
indent="col-
|
|
172
|
+
indent="col-3"
|
|
173
173
|
class="lg:mb-18 mb-10"
|
|
174
174
|
>
|
|
175
175
|
<BlockGist :data="block" />
|
|
@@ -199,14 +199,13 @@
|
|
|
199
199
|
:data="block"
|
|
200
200
|
/>
|
|
201
201
|
|
|
202
|
-
<
|
|
202
|
+
<div
|
|
203
203
|
v-else-if="block.blockType == 'ListBlock' && block.field === 'card_grid'"
|
|
204
|
-
:key="`
|
|
205
|
-
indent="col-1"
|
|
204
|
+
:key="`cardGridBlock${index}`"
|
|
206
205
|
class="lg:mb-18 mb-10"
|
|
207
206
|
>
|
|
208
207
|
<BlockCardGrid :cards="block.items" />
|
|
209
|
-
</
|
|
208
|
+
</div>
|
|
210
209
|
|
|
211
210
|
<div
|
|
212
211
|
v-else
|
|
@@ -115,16 +115,14 @@ export default defineComponent({
|
|
|
115
115
|
* Fall back to the linked page’s label, if there is one.
|
|
116
116
|
*/
|
|
117
117
|
theLabel(): string {
|
|
118
|
-
return
|
|
119
|
-
this.customLabel || this.label || (this.theTeaserPage && this.theTeaserPage.label) || ''
|
|
120
|
-
)
|
|
118
|
+
return this.customLabel || this.label || this.theTeaserPage?.label || ''
|
|
121
119
|
},
|
|
122
120
|
|
|
123
121
|
/**
|
|
124
122
|
* Fall back to the linked page’s title, if there is one.
|
|
125
123
|
*/
|
|
126
124
|
theHeading(): string {
|
|
127
|
-
return this.heading ||
|
|
125
|
+
return this.heading || this.theTeaserPage?.title || ''
|
|
128
126
|
},
|
|
129
127
|
|
|
130
128
|
/**
|
|
@@ -146,25 +144,30 @@ export default defineComponent({
|
|
|
146
144
|
},
|
|
147
145
|
// necessary as the streamfield teaser block passes an array of blocks
|
|
148
146
|
// this is necessary to retrieve the label from the teaser pages
|
|
149
|
-
theTeaserPage(): teaserPageObject |
|
|
150
|
-
if (this.
|
|
147
|
+
theTeaserPage(): teaserPageObject | undefined {
|
|
148
|
+
if (this.teaserPageBlock) {
|
|
149
|
+
return this.teaserPageBlock
|
|
150
|
+
} else if (this.teaserPage && typeof this.teaserPage === 'object') {
|
|
151
151
|
return this.teaserPage as teaserPageObject
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
}
|
|
153
|
+
return undefined
|
|
154
|
+
},
|
|
155
|
+
teaserPageBlock(): teaserPageObject | undefined {
|
|
156
|
+
if (Array.isArray(this.teaserPage) && this.teaserPage?.length) {
|
|
157
|
+
const filteredBlocks = this.teaserPage.filter(
|
|
158
|
+
(block: teaserPageBlock) => block.blockType === 'PageChooserBlock'
|
|
159
|
+
)
|
|
160
|
+
if (filteredBlocks?.length) {
|
|
161
|
+
return filteredBlocks[0].page
|
|
156
162
|
}
|
|
157
163
|
}
|
|
158
|
-
return
|
|
164
|
+
return undefined
|
|
159
165
|
}
|
|
160
166
|
},
|
|
161
167
|
methods: {
|
|
162
|
-
getTeaserPageBlock(): teaserPageBlock[] | null {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
return theBlocks.filter((block: teaserPageBlock) => block.blockType === 'PageChooserBlock')
|
|
166
|
-
}
|
|
167
|
-
return null
|
|
168
|
+
getTeaserPageBlock(page: any[]): teaserPageBlock[] | null {
|
|
169
|
+
const theBlocks = page
|
|
170
|
+
return theBlocks.filter((block: teaserPageBlock) => block.blockType === 'PageChooserBlock')
|
|
168
171
|
}
|
|
169
172
|
}
|
|
170
173
|
})
|
|
@@ -120,14 +120,10 @@ export const NavDesktopData = {
|
|
|
120
120
|
title: 'Missions'
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
|
-
...MenuLinkColumnWithHeaderData
|
|
124
|
-
heading: null,
|
|
125
|
-
headingPage: null
|
|
123
|
+
...MenuLinkColumnWithHeaderData
|
|
126
124
|
},
|
|
127
125
|
{
|
|
128
|
-
...MenuLinkColumnWithHeaderData
|
|
129
|
-
heading: null,
|
|
130
|
-
headingPage: null
|
|
126
|
+
...MenuLinkColumnWithHeaderData
|
|
131
127
|
}
|
|
132
128
|
]
|
|
133
129
|
},
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
<template v-else-if="data.heading">
|
|
17
17
|
<div class="text-subtitle text-jpl-blue-lighter edu:text-primary-lighter inline-block mb-4">
|
|
18
|
-
<span class="
|
|
18
|
+
<span class="px-2 block">{{ data.heading }}</span>
|
|
19
19
|
</div>
|
|
20
20
|
</template>
|
|
21
21
|
</div>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<BaseLink
|
|
33
33
|
variant="none"
|
|
34
34
|
href="https://www.nasa.gov/learning-resources/"
|
|
35
|
-
class="text-subtitle text-blue edu:text-white mb-3"
|
|
35
|
+
class="text-subtitle text-blue edu:text-white sm:mb-3 xl:col-span-2 md:col-span-3 col-span-4 mb-8"
|
|
36
36
|
link-class="flex flex-wrap-none overflow-visible whitespace-nowrap items-center"
|
|
37
37
|
external-target-blank
|
|
38
38
|
>
|
|
@@ -13,6 +13,7 @@ import PageEduExplainerArticle from './PageEduExplainerArticle.vue'
|
|
|
13
13
|
export default {
|
|
14
14
|
title: 'Templates/EDU/PageEduExplainerArticle',
|
|
15
15
|
component: PageEduExplainerArticle,
|
|
16
|
+
tags: ['!autodocs'],
|
|
16
17
|
decorators: [
|
|
17
18
|
() => ({
|
|
18
19
|
template: `<div id="storyDecorator" class="disable-nav-offset"><story/></div>`
|
|
@@ -28,6 +29,7 @@ export default {
|
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export const BaseStory = {
|
|
32
|
+
name: 'PageEduExplainerArticle',
|
|
31
33
|
args: {
|
|
32
34
|
data: {
|
|
33
35
|
__typename: 'EDUExplainerArticlePage',
|
|
@@ -50,7 +52,7 @@ export const BaseStory = {
|
|
|
50
52
|
showJumpMenu: true,
|
|
51
53
|
...BlockStreamfieldTruncatedData,
|
|
52
54
|
publicationDate: '2024-07-09',
|
|
53
|
-
|
|
55
|
+
topper: 'Topper of resource article',
|
|
54
56
|
getTopicsForDisplay: [
|
|
55
57
|
{
|
|
56
58
|
__typename: 'TopicPage',
|
|
@@ -5,6 +5,7 @@ import BaseImagePlaceholder from './../../../components/BaseImagePlaceholder/Bas
|
|
|
5
5
|
import BlockImageCarousel from './../../../components/BlockImageCarousel/BlockImageCarousel.vue'
|
|
6
6
|
import BlockImageComparison from './../../../components/BlockImageComparison/BlockImageComparison.vue'
|
|
7
7
|
import BlockLinkCarousel from './../../../components/BlockLinkCarousel/BlockLinkCarousel.vue'
|
|
8
|
+
import BlockText from './../../../components/BlockText/BlockText.vue'
|
|
8
9
|
import BlockVideo from './../../../components/BlockVideo/BlockVideo.vue'
|
|
9
10
|
import LayoutHelper from './../../../components/LayoutHelper/LayoutHelper.vue'
|
|
10
11
|
import DetailHeadline from './../../../components/DetailHeadline/DetailHeadline.vue'
|
|
@@ -30,6 +31,7 @@ export default defineComponent({
|
|
|
30
31
|
BlockImageComparison,
|
|
31
32
|
BlockLinkCarousel,
|
|
32
33
|
BlockRelatedLinks,
|
|
34
|
+
BlockText,
|
|
33
35
|
BlockVideo,
|
|
34
36
|
NavJumpMenu
|
|
35
37
|
},
|
|
@@ -170,17 +172,16 @@ export default defineComponent({
|
|
|
170
172
|
/>
|
|
171
173
|
</LayoutHelper>
|
|
172
174
|
|
|
173
|
-
<!-- summary and topper -->
|
|
174
175
|
<LayoutHelper
|
|
176
|
+
v-if="data.topper"
|
|
175
177
|
indent="col-3"
|
|
176
178
|
class="lg:mb-8 mb-5"
|
|
177
179
|
>
|
|
178
|
-
<
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
</p>
|
|
180
|
+
<BlockText
|
|
181
|
+
v-if="data.topper"
|
|
182
|
+
class="lg:mb-8 mb-5 px-4 lg:px-0"
|
|
183
|
+
:text="data.topper"
|
|
184
|
+
/>
|
|
184
185
|
</LayoutHelper>
|
|
185
186
|
|
|
186
187
|
<!-- streamfield blocks -->
|
package/src/utils/dayjs.js
CHANGED
|
@@ -3,7 +3,8 @@ import updateLocale from 'dayjs/plugin/updateLocale.js'
|
|
|
3
3
|
import localizedFormat from 'dayjs/plugin/localizedFormat.js'
|
|
4
4
|
import timezone from 'dayjs/plugin/timezone.js'
|
|
5
5
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js'
|
|
6
|
-
|
|
6
|
+
import duration from 'dayjs/plugin/duration.js'
|
|
7
|
+
import minMax from 'dayjs/plugin/minMax.js'
|
|
7
8
|
// Locales must be imported manually
|
|
8
9
|
// see https://github.com/iamkun/dayjs/tree/dev/src/locale
|
|
9
10
|
import 'dayjs/locale/en-gb.js'
|
|
@@ -29,4 +30,7 @@ dayjs.updateLocale('en', {
|
|
|
29
30
|
]
|
|
30
31
|
})
|
|
31
32
|
|
|
33
|
+
dayjs.extend(duration)
|
|
34
|
+
dayjs.extend(minMax)
|
|
35
|
+
|
|
32
36
|
export default dayjs
|