@explorer-1/html 1.1.1

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 (63) hide show
  1. package/.pre-commit-config.yaml +19 -0
  2. package/.stylelintcache +1 -0
  3. package/CHANGELOG.md +49 -0
  4. package/LICENSE +21 -0
  5. package/index.html +1202 -0
  6. package/package.json +55 -0
  7. package/postcss.config.js +7 -0
  8. package/src/assets/README.md +12 -0
  9. package/src/assets/fonts/README.md +12 -0
  10. package/src/assets/scss/styles.scss +1 -0
  11. package/src/components/AppBarInternal/AppBarInternal.js +102 -0
  12. package/src/components/BaseButton/BaseButton.js +115 -0
  13. package/src/components/BaseButton/BaseButton.stories.js +275 -0
  14. package/src/components/BaseImage/BaseImage.js +23 -0
  15. package/src/components/BaseImage/BaseImage.stories.js +85 -0
  16. package/src/components/BaseImagePlaceholder/BaseImagePlaceholder.js +47 -0
  17. package/src/components/BaseImagePlaceholder/BaseImagePlaceholder.stories.js +147 -0
  18. package/src/components/BaseLink/BaseLink.js +86 -0
  19. package/src/components/BaseLink/BaseLink.stories.js +114 -0
  20. package/src/components/FooterInternal/FooterInternal.js +156 -0
  21. package/src/components/FooterInternal/FooterInternal.stories.js +43 -0
  22. package/src/components/FooterInternal/FooterInternalContactList.js +30 -0
  23. package/src/components/HeaderInternal/HeaderInternal.docs.mdx +154 -0
  24. package/src/components/HeaderInternal/HeaderInternal.js +39 -0
  25. package/src/components/HeaderInternal/HeaderInternal.stories.js +64 -0
  26. package/src/components/Icons/IconArrow.js +20 -0
  27. package/src/components/Icons/IconCaret.js +19 -0
  28. package/src/components/Icons/IconClose.js +20 -0
  29. package/src/components/Icons/IconDownload.js +22 -0
  30. package/src/components/Icons/IconDropdown.js +19 -0
  31. package/src/components/Icons/IconExpand.js +20 -0
  32. package/src/components/Icons/IconExternal.js +19 -0
  33. package/src/components/Icons/IconMenu.js +20 -0
  34. package/src/components/Icons/IconNext.js +15 -0
  35. package/src/components/Icons/IconPrev.js +15 -0
  36. package/src/components/Icons/IconSearch.js +20 -0
  37. package/src/components/Icons/IconSocialEmail.js +20 -0
  38. package/src/components/Icons/IconSocialFacebook.js +20 -0
  39. package/src/components/Icons/IconSocialInstagram.js +23 -0
  40. package/src/components/Icons/IconSocialReddit.js +19 -0
  41. package/src/components/Icons/IconSocialTwitter.js +19 -0
  42. package/src/components/Icons/IconSocialYoutube.js +23 -0
  43. package/src/components/Icons/IconUser.js +16 -0
  44. package/src/components/LogoJPL/LogoJPL.docs.mdx +28 -0
  45. package/src/components/LogoJPL/LogoJPL.js +17 -0
  46. package/src/components/LogoJPL/LogoJPL.stories.js +40 -0
  47. package/src/components/MixinAnimationCaret/MixinAnimationCaret.js +42 -0
  48. package/src/components/MixinAnimationCaret/MixinAnimationCaret.stories.js +42 -0
  49. package/src/components/NavInternal/NavInternal.js +135 -0
  50. package/src/components/NavInternal/NavInternal.stories.js +68 -0
  51. package/src/components/NavInternal/NavInternalHighlight.js +64 -0
  52. package/src/components/NavInternal/NavInternalHighlight.stories.js +36 -0
  53. package/src/components/NavInternal/NavInternalPanel.js +88 -0
  54. package/src/components/NavInternal/NavInternalPanel.stories.js +248 -0
  55. package/src/components/NavInternal/NavInternalSection.js +47 -0
  56. package/src/components/NavInternal/NavInternalSection.stories.js +55 -0
  57. package/src/components/SearchInput/SearchInput.js +44 -0
  58. package/src/components/SearchInput/SearchInput.stories.js +30 -0
  59. package/src/main.js +6 -0
  60. package/stylelint.config.js +60 -0
  61. package/tailwind.config.js +19 -0
  62. package/tsconfig.json +23 -0
  63. package/vite.config.js +25 -0
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@explorer-1/html",
3
+ "version": "1.1.1",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "author": "JPL CreativeServices",
9
+ "type": "module",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/nasa-jpl/explorer-1/"
13
+ },
14
+ "prettier": "@explorer-1/prettier-config",
15
+ "browserslist": [
16
+ ">2.5%",
17
+ "last 4 versions",
18
+ "not last 4 safari versions",
19
+ "not last 4 ios_saf versions",
20
+ "last 2 safari versions",
21
+ "last 2 ios_saf versions",
22
+ "Firefox ESR",
23
+ "not dead",
24
+ "not OperaMini all",
25
+ "not IE 11"
26
+ ],
27
+ "dependencies": {
28
+ "@fancyapps/ui": "^6.1.13",
29
+ "@tailwindcss/forms": "^0.5.11",
30
+ "swiper": "^12.1.2",
31
+ "tailwindcss": "^3.4.19"
32
+ },
33
+ "devDependencies": {
34
+ "@storybook/addon-docs": "10.2.17",
35
+ "autoprefixer": "^10.4.27",
36
+ "postcss-import": "^16.1.1",
37
+ "typescript": "^5.9.3",
38
+ "vite": "^7.3.1",
39
+ "@explorer-1/common": "2.1.2",
40
+ "@explorer-1/prettier-config": "1.0.0"
41
+ },
42
+ "storybook": {
43
+ "url": "https://main--68c9f55524186336c6cb1c0c.chromatic.com"
44
+ },
45
+ "scripts": {
46
+ "dev": "vite",
47
+ "build": "pnpm build:vite && pnpm build:fontcss",
48
+ "build:vite": "vite build --emptyOutDir",
49
+ "build:fontfiles": "cp -R ./../common/src/fonts/ ./src/assets/fonts/",
50
+ "build:fontcss": "cp ./../common/src/scss/_fonts.scss ./../common/dist/assets/css/font-face.css",
51
+ "preview": "vite preview",
52
+ "lint": "eslint ./src",
53
+ "lint:fix": "eslint ./src --fix"
54
+ }
55
+ }
@@ -0,0 +1,7 @@
1
+ export default {
2
+ plugins: {
3
+ 'postcss-import': {},
4
+ tailwindcss: {},
5
+ autoprefixer: {}
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ # Fonts
2
+
3
+ Place optimized fonts file in this folder. We provide font files as WOFF 2.0 for all modern browsers.
4
+
5
+ - WOFF 2.0 conversion: [woff2](https://github.com/google/woff2)
6
+
7
+ Fonts:
8
+
9
+ - [Metropolis](https://fontsarena.com/metropolis-by-chris-simpson/)
10
+ - [Archivo Narrow](https://fonts.google.com/specimen/Archivo+Narrow)
11
+
12
+ See the styleguide for font usage guidelines.
@@ -0,0 +1,12 @@
1
+ # Fonts
2
+
3
+ Place optimized fonts file in this folder. We provide font files as WOFF 2.0 for all modern browsers.
4
+
5
+ - WOFF 2.0 conversion: [woff2](https://github.com/google/woff2)
6
+
7
+ Fonts:
8
+
9
+ - [Metropolis](https://fontsarena.com/metropolis-by-chris-simpson/)
10
+ - [Archivo Narrow](https://fonts.google.com/specimen/Archivo+Narrow)
11
+
12
+ See the styleguide for font usage guidelines.
@@ -0,0 +1 @@
1
+ @import '@explorer-1/common/src/scss/styles-with-fonts';
@@ -0,0 +1,102 @@
1
+ import { LogoJPLTemplate } from './../LogoJPL/LogoJPL'
2
+ import { IconCloseTemplate } from './../Icons/IconClose'
3
+ import { IconMenuTemplate } from './../Icons/IconMenu'
4
+ import { IconUserTemplate } from './../Icons/IconUser'
5
+
6
+ export const AppBarInternalTemplate = ({
7
+ orgNumber,
8
+ siteTitle,
9
+ includeMobileMenuToggle,
10
+ includeSignIn,
11
+ signedIn,
12
+ userData,
13
+ logInUrl,
14
+ logOutUrl
15
+ }) => {
16
+ // prop defaults
17
+ if (!orgNumber) orgNumber = ''
18
+ if (!siteTitle) siteTitle = ''
19
+ if (includeMobileMenuToggle == undefined) includeMobileMenuToggle = false
20
+ if (includeSignIn == undefined) includeSignIn = false
21
+ if (signedIn == undefined) signedIn = false
22
+ if (!userData) userData = {}
23
+ if (!logInUrl) logInUrl = '#'
24
+ if (!logOutUrl) logOutUrl = '#'
25
+
26
+ const mobileMenuToggleTemplate = includeMobileMenuToggle
27
+ ? `<button id="NavMobileToggle" class="block lg:hidden focus:outline-none focus:ring-2 p-2" aria-label="Open menu">
28
+ ${IconMenuTemplate({})}
29
+ ${IconCloseTemplate({})}
30
+ </button>
31
+ `
32
+ : ``
33
+
34
+ const signInTemplate = includeSignIn
35
+ ? signedIn && userData
36
+ ? `
37
+ <a href="${logOutUrl}" class="flex flex-nowrap items-center focus:outline-none focus:ring-2 mr-2 py-1">
38
+ <span class="hidden lg:block mr-2">
39
+ Sign Out
40
+ </span>
41
+ ${
42
+ userData.photo
43
+ ? `<span class="block shrink-0 w-6 h-6 overflow-hidden rounded-full border-2 border-white bg-white">
44
+ <img class="object-cover w-6 h-6" src="${userData.photo}" alt="${userData.firstName} ${userData.lastName}'s profile photo" />
45
+ </span>`
46
+ : `
47
+ <span class="block shrink-0">
48
+ ${IconUserTemplate({})}
49
+ </span>
50
+ `
51
+ }
52
+
53
+ </a>
54
+ `
55
+ : `
56
+ <a href="${logInUrl}" class="flex flex-nowrap items-center focus:outline-none focus:ring-2 mr-2 py-1 font-text tracking-[-.03rem] font-medium">
57
+ <span class="hidden lg:block mr-2">
58
+ Sign In
59
+ </span>
60
+ <span class="block shrink-0">
61
+ ${IconUserTemplate({})}
62
+ </span>
63
+ </a>
64
+ `
65
+ : ``
66
+
67
+ return `
68
+ <div class="AppBarInternal sticky lg:relative top-0 z-30">
69
+ <div class="bg-red-600 text-white font-medium relative z-10">
70
+ <div class="flex flex-row px-4 lg:container mx-auto py-2 items-center justify-between">
71
+ <div class="flex flex-row items-center py-px">
72
+ <a href="//js.jpl.nasa.gov" aria-label="JPL Space" class="block mr-10">
73
+ ${LogoJPLTemplate({ colorClass: 'text-white lg:w-14.5' })}
74
+ </a>
75
+ <a class="hidden lg:flex flex-row items-center text-3xl py-px leading-tighter font-display font-medium" href="/" title="${siteTitle}">
76
+ <span>
77
+ ${orgNumber}
78
+ </span>
79
+ <span class="border-l border-white pl-5 ml-5">
80
+ ${siteTitle}
81
+ </span>
82
+ </a>
83
+ </div>
84
+ <div class="flex flex-nowrap -mr-2">
85
+ ${signInTemplate}
86
+ ${mobileMenuToggleTemplate}
87
+ </div>
88
+ </div>
89
+ </div>
90
+ <div class="lg:hidden block relative z-30 bg-white shadow-lg py-4">
91
+ <a class=" px-4 lg:px-0 lg:container mx-auto flex flex-row items-baseline leading-tighter font-display font-medium" href="/" title="${siteTitle}">
92
+ <span class="text-3xl">
93
+ ${orgNumber}
94
+ </span>
95
+ <span class="text-lg border-l-2 border-gray-dark pl-3 ml-3">
96
+ ${siteTitle}
97
+ </span>
98
+ </a>
99
+ </div>
100
+ </div>
101
+ `
102
+ }
@@ -0,0 +1,115 @@
1
+ import { IconCaretTemplate } from '../Icons/IconCaret'
2
+ import { IconNextTemplate } from '../Icons/IconNext'
3
+ import { IconPrevTemplate } from '../Icons/IconPrev'
4
+ import { IconSocialFacebookTemplate } from '../Icons/IconSocialFacebook'
5
+ import { IconSocialTwitterTemplate } from '../Icons/IconSocialTwitter'
6
+ import { IconSocialInstagramTemplate } from '../Icons/IconSocialInstagram'
7
+ import { IconSocialYoutubeTemplate } from '../Icons/IconSocialYoutube'
8
+ import { IconSocialRedditTemplate } from '../Icons/IconSocialReddit'
9
+ import { IconExpandTemplate } from '../Icons/IconExpand'
10
+ import { IconExternalTemplate } from '../Icons/IconExternal'
11
+ import { IconDropdownTemplate } from '../Icons/IconDropdown'
12
+
13
+ export const BaseButtonTemplate = ({
14
+ label,
15
+ ariaLabel,
16
+ variant,
17
+ link,
18
+ caret,
19
+ compact,
20
+ disabled,
21
+ icon,
22
+ iconBefore,
23
+ iconOnly,
24
+ cssClass,
25
+ fancybox,
26
+ target
27
+ }) => {
28
+ if (iconBefore == undefined) iconBefore = false
29
+ if (iconOnly == undefined) iconOnly = false
30
+ fancybox = fancybox ? fancybox : ''
31
+ let iconTemplate = ''
32
+ let computedClass = ''
33
+
34
+ if (icon == 'next') iconTemplate = IconNextTemplate({})
35
+ else if (icon == 'prev') iconTemplate = IconPrevTemplate({})
36
+ else if (icon == 'expand') iconTemplate = IconExpandTemplate({})
37
+ else if (icon == 'facebook') iconTemplate = IconSocialFacebookTemplate({})
38
+ else if (icon == 'twitter') iconTemplate = IconSocialTwitterTemplate({})
39
+ else if (icon == 'instagram') iconTemplate = IconSocialInstagramTemplate({})
40
+ else if (icon == 'youtube') iconTemplate = IconSocialYoutubeTemplate({})
41
+ else if (icon == 'reddit') iconTemplate = IconSocialRedditTemplate({})
42
+ else if (icon == 'external') iconTemplate = IconExternalTemplate({})
43
+ else if (icon == 'dropdown') iconTemplate = IconDropdownTemplate({})
44
+ else if (caret) iconTemplate = IconCaretTemplate({})
45
+
46
+ // setup classnames
47
+ if (variant == 'primary') computedClass = '-primary'
48
+ else if (variant == 'secondary') computedClass = '-secondary'
49
+ else if (variant == 'dark') computedClass = '-dark'
50
+ else if (variant == 'social') computedClass = '-social'
51
+
52
+ if (compact) computedClass += ' -compact'
53
+ if (cssClass) computedClass += ' ' + cssClass
54
+ if (iconOnly) {
55
+ computedClass += ' -icon-only'
56
+ // eslint-disable-next-line no-self-assign
57
+ ariaLabel ? (ariaLabel = ariaLabel) : (ariaLabel = label)
58
+ label = ''
59
+ }
60
+
61
+ const content = iconBefore
62
+ ? `${iconTemplate}<span class="label-text">${label}</span>`
63
+ : `<span class="label-text">${label}</span>${iconTemplate}`
64
+
65
+ if (disabled) {
66
+ return `
67
+ <button
68
+ disabled="disabled"
69
+ class="BaseButton text-contrast-none inline-block ${computedClass}" ${
70
+ ariaLabel ? `aria-label="${ariaLabel}"` : ''
71
+ }
72
+ >
73
+ <span class="label block">
74
+ ${content}
75
+ </span>
76
+ </button>
77
+ `
78
+ } else if (link) {
79
+ return `
80
+ <a
81
+ href="${link}"
82
+ class="BaseButton text-contrast-none inline-block ${computedClass}" ${
83
+ target
84
+ ? `
85
+ target="${target}"`
86
+ : ''
87
+ } ${
88
+ ariaLabel
89
+ ? `
90
+ aria-label="${ariaLabel}"`
91
+ : ''
92
+ }
93
+ >
94
+ <span class="label block">
95
+ ${content}
96
+ </span>
97
+ </a>
98
+ `
99
+ } else {
100
+ return `
101
+ <button
102
+ class="BaseButton text-contrast-none inline-block ${computedClass}" ${
103
+ ariaLabel
104
+ ? `
105
+ aria-label="${ariaLabel}"`
106
+ : ''
107
+ } ${fancybox}
108
+ >
109
+ <span class="label block">
110
+ ${content}
111
+ </span>
112
+ </button>
113
+ `
114
+ }
115
+ }
@@ -0,0 +1,275 @@
1
+ import { BaseButtonTemplate } from './BaseButton.js'
2
+
3
+ export default {
4
+ title: 'Components/Base/BaseButton',
5
+ argTypes: {
6
+ label: {
7
+ type: 'string',
8
+ description: 'Button label'
9
+ },
10
+ ariaLabel: {
11
+ type: 'string',
12
+ description:
13
+ "ARIA label. Recommended if your button label isn't descriptive, or if it only contains an icon."
14
+ },
15
+ variant: {
16
+ type: 'string',
17
+ description: 'Button variant type',
18
+ control: {
19
+ type: 'select',
20
+ options: ['primary', 'secondary', 'dark', 'social']
21
+ },
22
+ table: {
23
+ defaultValue: { summary: 'default' }
24
+ }
25
+ },
26
+ link: {
27
+ type: 'string',
28
+ description: 'Button URL'
29
+ },
30
+ caret: {
31
+ type: 'boolean',
32
+ description: 'Display caret',
33
+ control: {
34
+ type: 'boolean'
35
+ },
36
+ table: {
37
+ defaultValue: { summary: 'false' }
38
+ }
39
+ },
40
+ compact: {
41
+ type: 'boolean',
42
+ description: '',
43
+ control: {
44
+ type: 'boolean'
45
+ },
46
+ table: {
47
+ defaultValue: { summary: 'false' }
48
+ }
49
+ },
50
+ disabled: {
51
+ type: 'boolean',
52
+ description: '',
53
+ control: {
54
+ type: 'boolean'
55
+ },
56
+ table: {
57
+ defaultValue: { summary: 'false' }
58
+ }
59
+ },
60
+ icon: {
61
+ type: 'string',
62
+ description: 'Button variant type',
63
+ control: {
64
+ type: 'select',
65
+ options: [
66
+ 'next',
67
+ 'prev',
68
+ 'expand',
69
+ 'external',
70
+ 'facebook',
71
+ 'twitter',
72
+ 'instagram',
73
+ 'youtube',
74
+ 'reddit',
75
+ 'dropdown'
76
+ ]
77
+ },
78
+ table: {
79
+ defaultValue: { summary: 'none' }
80
+ }
81
+ },
82
+ iconBefore: {
83
+ type: 'boolean',
84
+ description: 'If the icon should be positioned before the text.',
85
+ control: {
86
+ type: 'boolean'
87
+ },
88
+ table: {
89
+ defaultValue: { summary: 'false' }
90
+ }
91
+ },
92
+ iconOnly: {
93
+ type: 'boolean',
94
+ description: 'If the button will only include an icon and no text.',
95
+ control: {
96
+ type: 'boolean'
97
+ },
98
+ table: {
99
+ defaultValue: { summary: 'false' }
100
+ }
101
+ }
102
+ },
103
+ parameters: {
104
+ // viewMode: 'docs',
105
+ docs: {
106
+ description: {
107
+ component: 'Simple button with several style variations.'
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ export const Default = BaseButtonTemplate.bind({})
114
+ Default.storyName = 'Primary Button'
115
+ Default.args = {
116
+ label: 'Explore',
117
+ variant: 'primary',
118
+ link: '#',
119
+ caret: false,
120
+ compact: false,
121
+ disabled: false,
122
+ icon: null,
123
+ iconBefore: false,
124
+ iconOnly: false
125
+ }
126
+ export const Primary_Internal_Button = BaseButtonTemplate.bind({})
127
+ Primary_Internal_Button.args = {
128
+ label: 'Explore',
129
+ variant: 'primary',
130
+ link: '#',
131
+ caret: false,
132
+ compact: false,
133
+ disabled: false
134
+ }
135
+
136
+ export const Secondary_Button = BaseButtonTemplate.bind({})
137
+ Secondary_Button.args = {
138
+ label: 'Explore',
139
+ variant: 'secondary',
140
+ link: '#',
141
+ caret: false,
142
+ compact: false,
143
+ disabled: false
144
+ }
145
+
146
+ export const Dark_Button = BaseButtonTemplate.bind({})
147
+ Dark_Button.args = {
148
+ label: 'Explore',
149
+ variant: 'dark',
150
+ link: '#',
151
+ caret: false,
152
+ compact: false,
153
+ disabled: false
154
+ }
155
+ Dark_Button.decorators = [(Story) => `<div class="p-5 bg-jpl-blue-darker">${Story()}</div>`]
156
+
157
+ export const Primary_Icon_Button = BaseButtonTemplate.bind({})
158
+ Primary_Icon_Button.args = {
159
+ label: 'Explore',
160
+ variant: 'primary',
161
+ link: '#',
162
+ caret: false,
163
+ compact: false,
164
+ disabled: false,
165
+ icon: 'next',
166
+ iconOnly: true
167
+ }
168
+
169
+ export const Secondary_Icon_Button = BaseButtonTemplate.bind({})
170
+ Secondary_Icon_Button.args = {
171
+ label: 'Explore',
172
+ variant: 'secondary',
173
+ link: '#',
174
+ caret: false,
175
+ compact: false,
176
+ disabled: false,
177
+ icon: 'next',
178
+ iconOnly: true
179
+ }
180
+
181
+ export const Dark_Icon_Button = BaseButtonTemplate.bind({})
182
+ Dark_Icon_Button.args = {
183
+ label: 'Explore',
184
+ variant: 'dark',
185
+ link: '#',
186
+ caret: false,
187
+ compact: false,
188
+ disabled: false,
189
+ icon: 'next',
190
+ iconOnly: true
191
+ }
192
+ Dark_Icon_Button.decorators = [(Story) => `<div class="p-5 bg-jpl-blue-darker">${Story()}</div>`]
193
+
194
+ export const Social_Icon_Button = () => {
195
+ let facebook = BaseButtonTemplate({
196
+ label: 'Facebook',
197
+ variant: 'social',
198
+ link: '#',
199
+ caret: false,
200
+ compact: true,
201
+ disabled: false,
202
+ icon: 'facebook',
203
+ iconOnly: true,
204
+ cssClass: '-facebook w-12 h-12 text-2xl mr-3'
205
+ })
206
+ let twitter = BaseButtonTemplate({
207
+ label: 'X',
208
+ variant: 'social',
209
+ link: '#',
210
+ caret: false,
211
+ compact: true,
212
+ disabled: false,
213
+ icon: 'twitter',
214
+ iconOnly: true,
215
+ cssClass: '-twitter w-12 h-12 text-2xl mr-3'
216
+ })
217
+ let instagram = BaseButtonTemplate({
218
+ label: 'Instagram',
219
+ variant: 'social',
220
+ link: '#',
221
+ caret: false,
222
+ compact: true,
223
+ disabled: false,
224
+ icon: 'instagram',
225
+ iconOnly: true,
226
+ cssClass: '-instagram w-12 h-12 text-2xl mr-3'
227
+ })
228
+ let youtube = BaseButtonTemplate({
229
+ label: 'YouTube',
230
+ variant: 'social',
231
+ link: '#',
232
+ caret: false,
233
+ compact: true,
234
+ disabled: false,
235
+ icon: 'youtube',
236
+ iconOnly: true,
237
+ cssClass: '-youtube w-12 h-12 text-2xl mr-3'
238
+ })
239
+ let reddit = BaseButtonTemplate({
240
+ label: 'Reddit',
241
+ variant: 'social',
242
+ link: '#',
243
+ caret: false,
244
+ compact: true,
245
+ disabled: false,
246
+ icon: 'reddit',
247
+ iconOnly: true,
248
+ cssClass: '-reddit w-12 h-12 text-2xl mr-3'
249
+ })
250
+
251
+ return `${facebook} ${twitter} ${instagram} ${youtube} ${reddit}`
252
+ }
253
+ Social_Icon_Button.decorators = [(Story) => `<div class="p-5 flex items-center">${Story()}</div>`]
254
+
255
+ export const Disabled_Button = BaseButtonTemplate.bind({})
256
+ Disabled_Button.args = {
257
+ label: 'Explore',
258
+ variant: 'primary',
259
+ link: '#',
260
+ caret: false,
261
+ compact: false,
262
+ disabled: true
263
+ }
264
+
265
+ export const Disabled_Icon_Button = BaseButtonTemplate.bind({})
266
+ Disabled_Icon_Button.args = {
267
+ label: 'Explore',
268
+ variant: 'primary',
269
+ link: '#',
270
+ caret: false,
271
+ compact: false,
272
+ disabled: true,
273
+ icon: 'next',
274
+ iconOnly: true
275
+ }
@@ -0,0 +1,23 @@
1
+ export const BaseImageTemplate = ({
2
+ src,
3
+ srcset,
4
+ alt,
5
+ width,
6
+ height,
7
+ imageClass,
8
+ wrapperClass,
9
+ objectFitClass
10
+ }) => {
11
+ if (!src) src = ''
12
+ if (!srcset) srcset = ''
13
+ if (!alt) alt = ''
14
+ if (!width) width = ''
15
+ if (!height) height = ''
16
+ if (!imageClass) imageClass = ''
17
+ if (!objectFitClass) objectFitClass = ''
18
+ return `<div${wrapperClass ? ` class="${wrapperClass}"` : ''}>${
19
+ src
20
+ ? `<img class="BaseImage ${imageClass} ${objectFitClass} lazyload" src="${src}" srcset="${srcset}" alt="${alt}" width="${width}" height="${height}" loading="lazy" data-chromatic="ignore" />`
21
+ : ''
22
+ }</div>`
23
+ }
@@ -0,0 +1,85 @@
1
+ import { BaseImageTemplate } from './BaseImage.js'
2
+
3
+ export default {
4
+ title: 'Components/Base/BaseImage',
5
+ excludeStories: /.*Data$/,
6
+ argTypes: {
7
+ src: {
8
+ type: { name: 'string', required: true }
9
+ },
10
+ srcset: {
11
+ type: 'string'
12
+ },
13
+ alt: {
14
+ type: { name: 'string', required: true }
15
+ },
16
+ width: {
17
+ type: { name: 'number', required: true }
18
+ },
19
+ height: {
20
+ type: { name: 'number', required: true }
21
+ },
22
+ objectFitClass: {
23
+ type: 'string',
24
+ description:
25
+ 'Use Tailwind CSS object fit classes to specify how the image will scale within `BaseImagePlaceholder`',
26
+ control: {
27
+ type: 'select',
28
+ options: [
29
+ 'object-none',
30
+ 'object-contain',
31
+ 'object-cover',
32
+ 'object-fill',
33
+ 'object-scale-down'
34
+ ]
35
+ },
36
+ table: {
37
+ defaultValue: { summary: 'object-contain' }
38
+ }
39
+ },
40
+ imageClass: {
41
+ type: 'string',
42
+ description: 'Apply any CSS class directly to the image element'
43
+ }
44
+ },
45
+ parameters: {
46
+ docs: {
47
+ description: {
48
+ component:
49
+ 'The BaseImage component is a simple `<img />` tag wrapped in a `<div>` and is used to render an image with object-fit classes and lazy loading properties.'
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ export const BaseImageData = {
56
+ src: 'https://picsum.photos/800/400',
57
+ srcset: 'https://picsum.photos/800/400 800w, ',
58
+ alt: 'Alt text for image',
59
+ width: 800,
60
+ height: 400,
61
+ imageClass: '',
62
+ objectFitClass: 'object-contain'
63
+ }
64
+ export const Default = BaseImageTemplate.bind({})
65
+ Default.args = BaseImageData
66
+
67
+ export const LazyLoading = BaseImageTemplate.bind({})
68
+ LazyLoading.args = BaseImageData
69
+ LazyLoading.decorators = [
70
+ (Story) => `
71
+ <div class="max-w-full">
72
+ <div style="height:2500px">
73
+ Scroll down
74
+ </div>
75
+ <div id="storyRoot">
76
+ ${Story()}
77
+ </div>
78
+ </div>
79
+ `
80
+ ]
81
+ LazyLoading.parameters = {
82
+ html: {
83
+ root: '#storyRoot'
84
+ }
85
+ }