@explorer-1/vue 0.2.8 → 0.2.9

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.
Files changed (78) hide show
  1. package/components.d.ts +6 -1
  2. package/dist/explorer-1-vue.js +6871 -6420
  3. package/dist/explorer-1-vue.umd.cjs +13 -13
  4. package/dist/src/components/{BaseTag/BaseTag.stories.d.ts → BasePill/BasePill.stories.d.ts} +2 -2
  5. package/dist/src/components/{BaseTag/BaseTag.vue.d.ts → BasePill/BasePill.vue.d.ts} +7 -3
  6. package/dist/src/components/BlockLinkCard/BlockLinkCard.stories.d.ts +89 -15
  7. package/dist/src/components/BlockLinkCard/BlockLinkCard.vue.d.ts +66 -7
  8. package/dist/src/components/BlockLinkCarousel/BlockLinkCarousel.stories.d.ts +70 -2
  9. package/dist/src/components/BlockLinkTile/BlockLinkTile.vue.d.ts +4 -4
  10. package/dist/src/components/CalendarButton/CalendarButton.vue.d.ts +2 -2
  11. package/dist/src/components/CalendarChip/CalendarChip.vue.d.ts +36 -0
  12. package/dist/src/components/EventCard/EventCard.vue.d.ts +9 -0
  13. package/dist/src/components/EventDetailHero/EventDetailHero.vue.d.ts +27 -9
  14. package/dist/src/components/HeroListingIndex/HeroListingIndex.stories.d.ts +1 -0
  15. package/dist/src/components/HeroListingIndex/HeroListingIndex.vue.d.ts +6 -4
  16. package/dist/src/components/HeroMedium/HeroMedium.vue.d.ts +28 -2
  17. package/dist/src/components/Icons/IconProfile.vue.d.ts +2 -0
  18. package/dist/src/components/Icons/IconSubject.vue.d.ts +2 -0
  19. package/dist/src/components/Icons/Icons.stories.d.ts +17 -0
  20. package/dist/src/components/MetadataEduResource/MetadataEduResource.stories.d.ts +55 -0
  21. package/dist/src/components/MetadataEduResource/MetadataEduResource.vue.d.ts +38 -0
  22. package/dist/src/components/MetadataEvent/MetadataEvent.stories.d.ts +29 -0
  23. package/dist/src/components/MetadataEvent/MetadataEvent.vue.d.ts +38 -0
  24. package/dist/src/components/NavDesktopEdu/NavDesktopEdu.stories.d.ts +1 -0
  25. package/dist/src/components/SearchResultCard/SearchResultCard.stories.d.ts +23 -4
  26. package/dist/src/components/SearchResultCard/SearchResultCard.vue.d.ts +66 -1
  27. package/dist/src/components/SearchResultGridItem/SearchResultGridItem.stories.d.ts +7 -0
  28. package/dist/src/components/SearchResultGridItem/SearchResultGridItem.vue.d.ts +65 -11
  29. package/dist/src/components/SearchResultsList/SearchResultsList.stories.d.ts +404 -0
  30. package/dist/src/components/TopicDetailMoreItem/TopicDetailMoreItem.vue.d.ts +8 -4
  31. package/dist/src/constants.d.ts +4 -0
  32. package/dist/src/interfaces.d.ts +38 -3
  33. package/dist/src/templates/PageContent/PageContent.stories.d.ts +1 -0
  34. package/dist/src/templates/PageEventDetail/PageEventDetail.stories.d.ts +2 -13
  35. package/dist/src/templates/PageEventDetail/PageEventDetail.vue.d.ts +6 -3
  36. package/dist/src/templates/edu/PageEduEventDetail/PageEduEventDetail.stories.d.ts +153 -31
  37. package/dist/src/utils/mixins.d.ts +1 -1
  38. package/dist/src/utils/rangeifyGrades.d.ts +3 -0
  39. package/dist/style.css +1 -1
  40. package/lib/main.ts +2 -2
  41. package/package.json +2 -2
  42. package/src/components/{BaseTag/BaseTag.stories.js → BasePill/BasePill.stories.js} +3 -3
  43. package/src/components/BasePill/BasePill.vue +54 -0
  44. package/src/components/BlockLinkCard/BlockLinkCard.stories.js +93 -12
  45. package/src/components/BlockLinkCard/BlockLinkCard.vue +180 -39
  46. package/src/components/BlockLinkCarousel/BlockLinkCarousel.stories.js +60 -3
  47. package/src/components/BlockLinkTile/BlockLinkTile.vue +11 -8
  48. package/src/components/CalendarChip/CalendarChip.vue +52 -0
  49. package/src/components/DetailHeadline/DetailHeadline.vue +5 -5
  50. package/src/components/EventCard/EventCard.vue +28 -88
  51. package/src/components/EventDetailHero/EventDetailHero.vue +18 -25
  52. package/src/components/HeroListingIndex/HeroListingIndex.stories.js +1 -0
  53. package/src/components/HeroListingIndex/HeroListingIndex.vue +8 -3
  54. package/src/components/HeroMedium/HeroMedium.vue +24 -12
  55. package/src/components/Icons/IconProfile.vue +30 -0
  56. package/src/components/Icons/IconSubject.vue +38 -0
  57. package/src/components/Icons/Icons.stories.ts +15 -0
  58. package/src/components/MetadataEduResource/MetadataEduResource.stories.js +59 -0
  59. package/src/components/MetadataEduResource/MetadataEduResource.vue +93 -0
  60. package/src/components/MetadataEvent/MetadataEvent.stories.js +31 -0
  61. package/src/components/MetadataEvent/MetadataEvent.vue +164 -0
  62. package/src/components/SearchResultCard/SearchResultCard.stories.js +22 -5
  63. package/src/components/SearchResultCard/SearchResultCard.vue +71 -14
  64. package/src/components/SearchResultGridItem/SearchResultGridItem.stories.js +8 -1
  65. package/src/components/SearchResultGridItem/SearchResultGridItem.vue +81 -31
  66. package/src/components/SearchResultsList/SearchResultsList.stories.js +1197 -0
  67. package/src/components/SearchResultsList/SearchResultsList.vue +1 -0
  68. package/src/components/TopicDetailMoreItem/TopicDetailMoreItem.vue +12 -8
  69. package/src/constants.ts +20 -0
  70. package/src/interfaces.ts +41 -3
  71. package/src/templates/PageContent/PageContent.stories.js +1 -0
  72. package/src/templates/PageEventDetail/PageEventDetail.stories.js +1 -1
  73. package/src/templates/PageEventDetail/PageEventDetail.vue +25 -90
  74. package/src/templates/edu/PageEduEventDetail/PageEduEventDetail.stories.js +3 -2
  75. package/src/templates/edu/PageEduEventDetail/PageEduEventDetail.vue +38 -123
  76. package/src/utils/mixins.ts +1 -1
  77. package/src/utils/rangeifyGrades.ts +76 -0
  78. package/src/components/BaseTag/BaseTag.vue +0 -36
package/lib/main.ts CHANGED
@@ -44,7 +44,7 @@ import BaseModal from './../src/components/BaseModal/BaseModal.vue'
44
44
  import BasePlaceholder from './../src/components/BasePlaceholder/BasePlaceholder.vue'
45
45
  import BaseRadioGroup from './../src/components/BaseRadioGroup/BaseRadioGroup.vue'
46
46
  import BaseSwimlane from './../src/components/BaseSwimlane/BaseSwimlane.vue'
47
- import BaseTag from './../src/components/BaseTag/BaseTag.vue'
47
+ import BasePill from './../src/components/BasePill/BasePill.vue'
48
48
  import BaseTimer from './../src/components/BaseTimer/BaseTimer.vue'
49
49
  import BaseUnitToggle from './../src/components/BaseUnitToggle/BaseUnitToggle.vue'
50
50
  import BaseVideo from './../src/components/BaseVideo/BaseVideo.vue'
@@ -248,7 +248,7 @@ export {
248
248
  BasePlaceholder,
249
249
  BaseRadioGroup,
250
250
  BaseSwimlane,
251
- BaseTag,
251
+ BasePill,
252
252
  BaseTimer,
253
253
  BaseUnitToggle,
254
254
  BaseVideo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@explorer-1/vue",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,7 @@
29
29
  "vue": "^3.4.21",
30
30
  "vue-observe-visibility": "^1.0.0",
31
31
  "vue3-compare-image": "^1.2.5",
32
- "@explorer-1/common": "1.1.3"
32
+ "@explorer-1/common": "1.1.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@vitejs/plugin-vue": "^5.0.4",
@@ -1,8 +1,8 @@
1
- import BaseTag from './BaseTag.vue'
1
+ import BasePill from './BasePill.vue'
2
2
 
3
3
  export default {
4
- title: 'Components/Base/BaseTag',
5
- component: BaseTag,
4
+ title: 'Components/Base/BasePill',
5
+ component: BasePill,
6
6
  argTypes: {
7
7
  variant: {
8
8
  type: { name: 'string', required: false },
@@ -0,0 +1,54 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import type { Attributes } from './../../interfaces'
4
+ import { eduMetadataDictionary } from './../../constants'
5
+
6
+ // using borders to vertically center wonky font face
7
+ const variantMap: Attributes = {
8
+ primary: 'bg-primary border-primary',
9
+ secondary: 'bg-secondary border-secondary',
10
+ action: 'bg-action border-action'
11
+ }
12
+
13
+ const sizeMap: Attributes = {
14
+ sm: 'text-xs border-t-2 py-1 px-2.5',
15
+ md: 'text-xs lg:text-base border-t py-1.5 px-3.5',
16
+ lg: 'text-base lg:text-lg border-t pt-1.5 pb-1 px-5'
17
+ }
18
+
19
+ interface BasePillProps {
20
+ variant?: string
21
+ size?: string
22
+ contentType?: string
23
+ }
24
+
25
+ // define props
26
+ const props = withDefaults(defineProps<BasePillProps>(), {
27
+ variant: 'primary',
28
+ size: 'md',
29
+ contentType: undefined
30
+ })
31
+
32
+ const metadataType = computed(() => {
33
+ const validContentTypes = Object.keys(eduMetadataDictionary)
34
+ return props.contentType && validContentTypes.includes(props.contentType)
35
+ ? props.contentType
36
+ : undefined
37
+ })
38
+ const metadataAttrs = computed(() => {
39
+ if (metadataType.value) {
40
+ return eduMetadataDictionary[metadataType.value]
41
+ }
42
+ return { variant: undefined, label: undefined }
43
+ })
44
+ </script>
45
+ <template>
46
+ <p
47
+ :class="`${variantMap[metadataAttrs.variant || props.variant]} ${sizeMap[props.size]}`"
48
+ class="ThemeVariantLight text-contrast-none inline-block text-white font-bold edu:font-extrabold rounded-full leading-tight m-0 uppercase print:border-none print:px-0"
49
+ >
50
+ <template v-if="metadataAttrs.label"> {{ metadataAttrs.label }} </template>
51
+ <template v-else> <slot /></template>
52
+ <span class="sr-only">.</span>
53
+ </p>
54
+ </template>
@@ -7,12 +7,13 @@ export default {
7
7
  component: BlockLinkCard,
8
8
  tags: ['!autodocs'],
9
9
  excludeStories: /.*Data$/,
10
- decorators: [
11
- () => ({
12
- template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3 lg:grid-cols-3"><story/></div>`
13
- })
14
- ],
15
10
  argTypes: {
11
+ size: {
12
+ control: {
13
+ type: 'select',
14
+ options: ['sm', 'md', 'lg']
15
+ }
16
+ },
16
17
  headingLevel: {
17
18
  description:
18
19
  'Change the heading level for semantic markup. This does not affect the style of the heading.',
@@ -47,25 +48,39 @@ export const BlockLinkCardData = {
47
48
  },
48
49
  headingLevel: 'h2',
49
50
  startDate: undefined,
50
- endDate: undefined,
51
- compact: false
51
+ endDate: undefined
52
52
  }
53
53
 
54
54
  export const BaseStory = {
55
55
  name: 'Single Item',
56
+ decorators: [
57
+ () => ({
58
+ template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3"><story/></div>`
59
+ })
60
+ ],
56
61
  args: {
57
62
  ...BlockLinkCardData
58
63
  }
59
64
  }
60
65
 
61
66
  export const SingleItemCompactStyles = {
67
+ decorators: [
68
+ () => ({
69
+ template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3"><story/></div>`
70
+ })
71
+ ],
62
72
  args: {
63
73
  ...BlockLinkCardData,
64
74
  headingLevel: 'h2',
65
- compact: true
75
+ size: 'sm'
66
76
  }
67
77
  }
68
78
  export const Compact = {
79
+ decorators: [
80
+ () => ({
81
+ template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3"><story/></div>`
82
+ })
83
+ ],
69
84
  name: 'Compact w/ Custom Props',
70
85
  parameters: {
71
86
  docs: {
@@ -89,16 +104,82 @@ export const Compact = {
89
104
  alt: 'Alt text'
90
105
  },
91
106
  headingLevel: 'h2',
92
- compact: true
107
+ size: 'sm'
93
108
  }
94
109
  }
95
110
  export const EventItem = {
111
+ decorators: [
112
+ () => ({
113
+ template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3"><story/></div>`
114
+ })
115
+ ],
96
116
  args: {
97
117
  ...BlockLinkCardData,
98
118
  data: {
99
- ...BlockLinkCardData.data,
100
- startDate: '2021-11-11T00:00:00-08:00',
101
- endDate: '2021-11-11T23:59:59.999999-08:00'
119
+ page: {
120
+ ...BlockLinkCardData.data,
121
+ __typename: 'EDUEventPage',
122
+ startDate: '2021-11-11',
123
+ startDatetime: '2021-11-11T00:00:00-08:00',
124
+ endDatetime: '2021-11-11T23:59:59.999999-08:00',
125
+ endDate: '2021-11-11',
126
+ ongoing: false,
127
+ eventType: 'Workshop'
128
+ }
129
+ }
130
+ }
131
+ }
132
+ export const EduExplainerArticle = {
133
+ decorators: [
134
+ () => ({
135
+ template: `<div id="storyDecorator" class="relative grid grid-cols-2 gap-3"><story/></div>`
136
+ })
137
+ ],
138
+ args: {
139
+ ...BlockLinkCardData,
140
+ data: {
141
+ page: {
142
+ __typename: 'EDUExplainerArticlePage',
143
+ ...BlockLinkCardData.data,
144
+ primarySubject: {
145
+ subject: 'Engineering'
146
+ },
147
+ gradeLevels: [
148
+ { gradeLevel: 'All Ages' },
149
+ { gradeLevel: 'K' },
150
+ { gradeLevel: '1' },
151
+ { gradeLevel: '2' },
152
+ { gradeLevel: '5' },
153
+ { gradeLevel: '6' },
154
+ { gradeLevel: '7' },
155
+ { gradeLevel: '8' }
156
+ ]
157
+ }
158
+ }
159
+ }
160
+ }
161
+ export const LargeEduExplainerArticle = {
162
+ args: {
163
+ ...BlockLinkCardData,
164
+ size: 'lg',
165
+ data: {
166
+ page: {
167
+ __typename: 'EDUExplainerArticlePage',
168
+ ...BlockLinkCardData.data,
169
+ primarySubject: {
170
+ subject: 'Engineering'
171
+ },
172
+ gradeLevels: [
173
+ { gradeLevel: 'All Ages' },
174
+ { gradeLevel: 'K' },
175
+ { gradeLevel: '1' },
176
+ { gradeLevel: '2' },
177
+ { gradeLevel: '5' },
178
+ { gradeLevel: '6' },
179
+ { gradeLevel: '7' },
180
+ { gradeLevel: '8' }
181
+ ]
182
+ }
102
183
  }
103
184
  }
104
185
  }
@@ -5,13 +5,13 @@
5
5
  :to="theItem.url ? theItem.url : undefined"
6
6
  :href="theItem.externalLink ? theItem.externalLink : undefined"
7
7
  class="BlockLinkCard group"
8
- :link-class="`block ${compact ? 'pb-3' : 'pb-5'}`"
8
+ :link-class="`block ${small ? 'pb-3' : 'pb-5'} ${large ? 'sm:flex flex-row' : ''}`"
9
9
  external-target-blank
10
10
  >
11
11
  <BaseImagePlaceholder
12
- aspect-ratio="16:9"
13
- class="bg-gray-dark relative mb-6 overflow-hidden"
14
- :class="{ 'lg:mb-10': !compact }"
12
+ :aspect-ratio="large ? '3:2' : '16:9'"
13
+ class="bg-gray-dark relative mb-6 edu:lg:mb-8 overflow-hidden"
14
+ :class="{ 'lg:mb-10': medium, 'sm:w-1/3': large }"
15
15
  dark-mode
16
16
  no-logo
17
17
  >
@@ -26,52 +26,100 @@
26
26
  loading="lazy"
27
27
  />
28
28
  <div v-else></div>
29
+ <CalendarChip
30
+ v-if="
31
+ themeStore.isEdu &&
32
+ ((theItem as EventCardObject).startDate || (theItem as EventCardObject).ongoing)
33
+ "
34
+ :start-date="(theItem as EventCardObject).startDate"
35
+ :end-date="(theItem as EventCardObject).endDate"
36
+ :ongoing="(theItem as EventCardObject).ongoing"
37
+ />
29
38
  </BaseImagePlaceholder>
30
39
 
31
40
  <div
32
- class="BlockLinkCard__CardContent transition-translate can-hover:group-hover:delay-200 duration-200 ease-in transform"
33
- :class="
34
- compact ? 'can-hover:group-hover:-translate-y-2' : 'can-hover:group-hover:-translate-y-3'
35
- "
41
+ class="BlockLinkCard__CardContent transition-translate can-hover:group-hover:delay-200 duration-200 ease-in transform ThemeVariantLight"
42
+ :class="contentClasses"
36
43
  >
37
- <div class="flex flex-wrap">
38
- <p
39
- v-if="theItem.label || theItem.startDate"
40
- class="text-subtitle divide-gray-mid flex divide-x"
41
- :class="compact ? 'mb-2' : 'mb-4'"
44
+ <template v-if="metadataType && metadataAttrs">
45
+ <BasePill
46
+ :class="{ 'mb-2': !large, 'mb-4': large }"
47
+ size="sm"
48
+ :content-type="metadataType"
42
49
  >
43
- <span
44
- v-if="theItem.label"
45
- :class="{ 'pr-2': theItem.startDate }"
50
+ {{ (theItem as EventCardObject).eventType }}
51
+ </BasePill>
52
+ </template>
53
+ <template v-else>
54
+ <div class="flex flex-wrap">
55
+ <p
56
+ v-if="theItem.label || ((theItem as EventCardObject).startDate && !themeStore.isEdu)"
57
+ class="text-subtitle divide-gray-mid flex divide-x"
58
+ :class="small ? 'mb-2' : 'mb-4'"
46
59
  >
47
- {{ theItem.label }}
48
- </span>
49
- <span
50
- v-if="theItem.startDate"
51
- :class="{ 'text-gray-mid-dark pl-2': theItem.label }"
52
- >
53
- {{ formattedEventDates }}
54
- </span>
55
- <span class="sr-only">.</span>
56
- </p>
57
- </div>
60
+ <span
61
+ v-if="theItem.label"
62
+ class="edu:text-primary ThemeVariantLight"
63
+ :class="{ 'pr-2': (theItem as EventCardObject).startDate && !themeStore.isEdu }"
64
+ >
65
+ {{ theItem.label }}
66
+ </span>
67
+ <span
68
+ v-if="(theItem as EventCardObject).startDate && !themeStore.isEdu"
69
+ :class="{ 'text-gray-mid-dark pl-2': theItem.label }"
70
+ >
71
+ {{ formattedEventDates }}
72
+ </span>
73
+ <span class="sr-only">.</span>
74
+ </p>
75
+ </div>
76
+ </template>
58
77
 
59
78
  <component
60
79
  :is="headingLevel || 'p'"
61
80
  class="text-gray-dark text-xl font-medium leading-tight tracking-tight edu:font-extrabold"
62
- :class="{ 'lg:text-3xl': !compact }"
81
+ :class="{ 'lg:text-3xl': !small }"
63
82
  >
64
83
  {{ theItem.title }}
65
84
  </component>
66
85
  <p
67
86
  v-if="theItem.date"
68
87
  class="text-gray-mid-dark mt-2"
88
+ :class="{ 'mt-2': !large, 'mt-4': large }"
69
89
  >
70
90
  {{ theItem.date }}
71
91
  </p>
92
+ <p
93
+ v-if="large && theItem.summary"
94
+ class="mt-4 text-gray-mid-dark"
95
+ >
96
+ {{ theItem.summary }}
97
+ </p>
98
+ <div
99
+ v-if="metadataType && metadataAttrs"
100
+ :class="{ 'mt-4': large, 'mt-2 mb-1': medium, 'mt-1 mb-0': small }"
101
+ >
102
+ <MetadataEvent
103
+ v-if="metadataType === 'EDUEventPage'"
104
+ :event="theItem"
105
+ compact
106
+ />
107
+ <MetadataEduResource
108
+ v-else-if="metadataType === 'EDUExplainerArticlePage'"
109
+ :resource="theItem as EduResourceCardObject"
110
+ :variant="eduMetadataDictionaryComputed[metadataType].variant"
111
+ compact
112
+ />
113
+ </div>
72
114
  </div>
73
115
  <div
74
- class="BlockLinkCard__CardArrow ThemeVariantLight can-hover:block text-action can-hover:-ml-3 can-hover:group-hover:delay-200 can-hover:opacity-0 can-hover:group-hover:ml-0 can-hover:group-hover:opacity-100 hidden -mt-1 text-2xl leading-normal transition-all duration-200 ease-in"
116
+ v-if="!large"
117
+ class="BlockLinkCard__CardArrow ThemeVariantLight can-hover:block can-hover:-ml-3 can-hover:group-hover:delay-200 can-hover:opacity-0 can-hover:group-hover:ml-0 can-hover:group-hover:opacity-100 hidden -mt-1 text-2xl leading-normal transition-all duration-200 ease-in"
118
+ :class="
119
+ metadataType && metadataAttrs
120
+ ? `text-${eduMetadataDictionaryComputed[metadataType].variant}`
121
+ : 'text-primary'
122
+ "
75
123
  >
76
124
  <IconArrow />
77
125
  </div>
@@ -80,14 +128,21 @@
80
128
 
81
129
  <script lang="ts">
82
130
  import type { PropType } from 'vue'
131
+ import type { Card, EventCardObject, EduResourceCardObject } from '../../interfaces'
83
132
  import { defineComponent } from 'vue'
84
- import type { Card } from '../../interfaces'
133
+ import { mapStores } from 'pinia'
134
+ import { useThemeStore } from '../../store/theme'
85
135
  import { mixinFormatEventDates } from './../../utils/mixins'
136
+ import type { HeadingLevel } from './../BaseHeading/BaseHeading.vue'
86
137
  import IconArrow from './../Icons/IconArrow.vue'
87
138
  import BaseLink from './../BaseLink/BaseLink.vue'
88
139
  import BaseImage from './../BaseImage/BaseImage.vue'
89
140
  import BaseImagePlaceholder from './../BaseImagePlaceholder/BaseImagePlaceholder.vue'
90
- import type { HeadingLevel } from './../BaseHeading/BaseHeading.vue'
141
+ import BasePill from './../BasePill/BasePill.vue'
142
+ import CalendarChip from './../CalendarChip/CalendarChip.vue'
143
+ import MetadataEvent from './../MetadataEvent/MetadataEvent.vue'
144
+ import MetadataEduResource from './../MetadataEduResource/MetadataEduResource.vue'
145
+ import { eduMetadataDictionary } from './../../constants'
91
146
 
92
147
  export default defineComponent({
93
148
  name: 'BlockLinkCard',
@@ -95,7 +150,11 @@ export default defineComponent({
95
150
  IconArrow,
96
151
  BaseLink,
97
152
  BaseImage,
98
- BaseImagePlaceholder
153
+ BaseImagePlaceholder,
154
+ BasePill,
155
+ CalendarChip,
156
+ MetadataEvent,
157
+ MetadataEduResource
99
158
  },
100
159
  props: {
101
160
  data: {
@@ -135,6 +194,10 @@ export default defineComponent({
135
194
  required: false,
136
195
  default: undefined
137
196
  },
197
+ eventType: {
198
+ type: String,
199
+ default: undefined
200
+ },
138
201
  startDate: {
139
202
  type: String,
140
203
  required: false,
@@ -145,11 +208,27 @@ export default defineComponent({
145
208
  required: false,
146
209
  default: undefined
147
210
  },
148
- // if styling should be compact
149
- compact: {
211
+ ongoing: {
150
212
  type: Boolean,
151
213
  default: false
152
214
  },
215
+ startDatetime: {
216
+ type: String,
217
+ default: undefined
218
+ },
219
+ endDatetime: {
220
+ type: String,
221
+ default: undefined
222
+ },
223
+ location: {
224
+ type: String,
225
+ default: undefined
226
+ },
227
+ // if styling should be compact
228
+ size: {
229
+ type: String,
230
+ default: 'md'
231
+ },
153
232
  // if a heading should be used and at what level
154
233
  headingLevel: {
155
234
  type: (String as PropType<HeadingLevel>) || null,
@@ -158,10 +237,34 @@ export default defineComponent({
158
237
  }
159
238
  },
160
239
  computed: {
240
+ ...mapStores(useThemeStore),
241
+ small() {
242
+ return this.size === 'sm'
243
+ },
244
+ medium() {
245
+ return this.size === 'md'
246
+ },
247
+ large() {
248
+ return this.size === 'lg'
249
+ },
250
+ contentClasses() {
251
+ let classes = ''
252
+ if (this.small) {
253
+ classes = 'can-hover:group-hover:-translate-y-2'
254
+ } else if (this.medium) {
255
+ classes = 'can-hover:group-hover:-translate-y-3 edu:can-hover:group-hover:-translate-y-2'
256
+ } else if (this.large) {
257
+ classes = 'sm:pl-8 sm:w-2/3'
258
+ }
259
+ return classes
260
+ },
261
+ eduMetadataDictionaryComputed() {
262
+ return eduMetadataDictionary
263
+ },
161
264
  // to allow for various data shapes and sources
162
265
  // use-case: content pages provide this.data.page with non-page siblings (i.e. external link cards)
163
266
  // use-case: search and listing pages pass individual props
164
- theItem(): Card | undefined {
267
+ theItem(): Card | EventCardObject | EduResourceCardObject | undefined {
165
268
  if ((this.data as Card)?.page) {
166
269
  return (this.data as Card).page
167
270
  } else if (this.data) {
@@ -174,7 +277,12 @@ export default defineComponent({
174
277
  this.title ||
175
278
  this.date ||
176
279
  this.startDate ||
177
- this.endDate
280
+ this.endDate ||
281
+ this.eventType ||
282
+ this.startDatetime ||
283
+ this.endDatetime ||
284
+ this.ongoing ||
285
+ this.location
178
286
  ) {
179
287
  // form a custom object
180
288
  return {
@@ -185,14 +293,34 @@ export default defineComponent({
185
293
  title: this.title,
186
294
  date: this.date,
187
295
  startDate: this.startDate,
188
- endDate: this.endDate
296
+ endDate: this.endDate,
297
+ eventType: this.eventType,
298
+ startDatetime: this.startDatetime,
299
+ endDatetime: this.endDatetime,
300
+ ongoing: this.ongoing,
301
+ locationName: this.location
189
302
  }
190
303
  }
191
304
  return undefined
192
305
  },
306
+ metadataType() {
307
+ const validContentTypes = Object.keys(eduMetadataDictionary)
308
+ return this.data?.page?.__typename && validContentTypes.includes(this.data?.page?.__typename)
309
+ ? this.data?.page?.__typename
310
+ : undefined
311
+ },
312
+ metadataAttrs() {
313
+ if (this.metadataType) {
314
+ return eduMetadataDictionary[this.metadataType]
315
+ }
316
+ return undefined
317
+ },
193
318
  formattedEventDates() {
194
- return this.theItem?.startDate
195
- ? mixinFormatEventDates(this.theItem.startDate, this.theItem.endDate)
319
+ return (this.theItem as EventCardObject)?.startDate
320
+ ? mixinFormatEventDates(
321
+ (this.theItem as EventCardObject).startDate,
322
+ (this.theItem as EventCardObject).endDate
323
+ )
196
324
  : undefined
197
325
  }
198
326
  }
@@ -214,5 +342,18 @@ export default defineComponent({
214
342
  @apply bg-gray-mid-dark;
215
343
  }
216
344
  }
345
+ .MetadataEvent,
346
+ .MetadataEduResource {
347
+ &.-compact {
348
+ .MetadataEventItem,
349
+ .MetadataEduResourceItem {
350
+ @apply mr-2.5;
351
+ }
352
+ }
353
+ .MetadataEventIcon,
354
+ .MetadataEduResourceIcon {
355
+ @apply mr-1;
356
+ }
357
+ }
217
358
  }
218
359
  </style>
@@ -143,10 +143,18 @@ export const EventsBlockLinkCarouselData = [
143
143
  }
144
144
  },
145
145
  title: 'Past event',
146
- url: '/events/becoming-a-nasa-engineer'
146
+ url: '/events/becoming-a-nasa-engineer',
147
+ startDatetime: '2019-11-11T00:00:00-08:00',
148
+ ongoing: false,
149
+ isVirtualEvent: false,
150
+ endDatetime: null,
151
+ eventType: 'Internship',
152
+ locationName: 'Webcast',
153
+ locationLink: 'https://www.nasa.gov',
154
+ customDate: undefined
147
155
  },
148
156
  {
149
- endDate: null,
157
+ endDate: '2021-12-1',
150
158
  startDate: '2021-11-27',
151
159
  thumbnailImage: {
152
160
  src: {
@@ -156,7 +164,56 @@ export const EventsBlockLinkCarouselData = [
156
164
  }
157
165
  },
158
166
  title: 'Future event',
159
- url: '/events/becoming-a-nasa-engineer'
167
+ eventType: 'Workshop',
168
+ url: '/events/becoming-a-nasa-engineer',
169
+ startDatetime: '2021-11-11T00:00:00-08:00',
170
+ ongoing: false,
171
+ isVirtualEvent: false,
172
+ endDatetime: '2021-12-01T23:59:59.999999-08:00',
173
+ locationName: 'Webcast',
174
+ locationLink: 'https://www.nasa.gov',
175
+ customDate: undefined
176
+ },
177
+ {
178
+ endDate: '2021-12-1',
179
+ startDate: '2021-11-27',
180
+ thumbnailImage: {
181
+ src: {
182
+ height: '288',
183
+ url: 'https://picsum.photos/512/288',
184
+ width: '512'
185
+ }
186
+ },
187
+ title: 'Custom event',
188
+ eventType: 'Workshop',
189
+ url: '/events/becoming-a-nasa-engineer',
190
+ startDatetime: '2021-11-11T00:00:00-08:00',
191
+ customDate: 'Custom date goes here',
192
+ ongoing: false,
193
+ isVirtualEvent: false,
194
+ endDatetime: '2021-12-01T23:59:59.999999-08:00',
195
+ locationName: 'Webcast',
196
+ locationLink: 'https://www.nasa.gov'
197
+ },
198
+ {
199
+ endDate: '2021-12-1',
200
+ startDate: '2021-11-27',
201
+ thumbnailImage: {
202
+ src: {
203
+ height: '288',
204
+ url: 'https://picsum.photos/512/288',
205
+ width: '512'
206
+ }
207
+ },
208
+ title: 'Ongoing event',
209
+ url: '/events/becoming-a-nasa-engineer',
210
+ startDatetime: '2021-11-11T00:00:00-08:00',
211
+ customDate: 'Custom date goes here',
212
+ ongoing: true,
213
+ isVirtualEvent: false,
214
+ endDatetime: '2021-12-01T23:59:59.999999-08:00',
215
+ locationName: 'Webcast',
216
+ locationLink: 'https://www.nasa.gov'
160
217
  }
161
218
  ]
162
219