@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.
- package/.pre-commit-config.yaml +19 -0
- package/.stylelintcache +1 -0
- package/CHANGELOG.md +49 -0
- package/LICENSE +21 -0
- package/index.html +1202 -0
- package/package.json +55 -0
- package/postcss.config.js +7 -0
- package/src/assets/README.md +12 -0
- package/src/assets/fonts/README.md +12 -0
- package/src/assets/scss/styles.scss +1 -0
- package/src/components/AppBarInternal/AppBarInternal.js +102 -0
- package/src/components/BaseButton/BaseButton.js +115 -0
- package/src/components/BaseButton/BaseButton.stories.js +275 -0
- package/src/components/BaseImage/BaseImage.js +23 -0
- package/src/components/BaseImage/BaseImage.stories.js +85 -0
- package/src/components/BaseImagePlaceholder/BaseImagePlaceholder.js +47 -0
- package/src/components/BaseImagePlaceholder/BaseImagePlaceholder.stories.js +147 -0
- package/src/components/BaseLink/BaseLink.js +86 -0
- package/src/components/BaseLink/BaseLink.stories.js +114 -0
- package/src/components/FooterInternal/FooterInternal.js +156 -0
- package/src/components/FooterInternal/FooterInternal.stories.js +43 -0
- package/src/components/FooterInternal/FooterInternalContactList.js +30 -0
- package/src/components/HeaderInternal/HeaderInternal.docs.mdx +154 -0
- package/src/components/HeaderInternal/HeaderInternal.js +39 -0
- package/src/components/HeaderInternal/HeaderInternal.stories.js +64 -0
- package/src/components/Icons/IconArrow.js +20 -0
- package/src/components/Icons/IconCaret.js +19 -0
- package/src/components/Icons/IconClose.js +20 -0
- package/src/components/Icons/IconDownload.js +22 -0
- package/src/components/Icons/IconDropdown.js +19 -0
- package/src/components/Icons/IconExpand.js +20 -0
- package/src/components/Icons/IconExternal.js +19 -0
- package/src/components/Icons/IconMenu.js +20 -0
- package/src/components/Icons/IconNext.js +15 -0
- package/src/components/Icons/IconPrev.js +15 -0
- package/src/components/Icons/IconSearch.js +20 -0
- package/src/components/Icons/IconSocialEmail.js +20 -0
- package/src/components/Icons/IconSocialFacebook.js +20 -0
- package/src/components/Icons/IconSocialInstagram.js +23 -0
- package/src/components/Icons/IconSocialReddit.js +19 -0
- package/src/components/Icons/IconSocialTwitter.js +19 -0
- package/src/components/Icons/IconSocialYoutube.js +23 -0
- package/src/components/Icons/IconUser.js +16 -0
- package/src/components/LogoJPL/LogoJPL.docs.mdx +28 -0
- package/src/components/LogoJPL/LogoJPL.js +17 -0
- package/src/components/LogoJPL/LogoJPL.stories.js +40 -0
- package/src/components/MixinAnimationCaret/MixinAnimationCaret.js +42 -0
- package/src/components/MixinAnimationCaret/MixinAnimationCaret.stories.js +42 -0
- package/src/components/NavInternal/NavInternal.js +135 -0
- package/src/components/NavInternal/NavInternal.stories.js +68 -0
- package/src/components/NavInternal/NavInternalHighlight.js +64 -0
- package/src/components/NavInternal/NavInternalHighlight.stories.js +36 -0
- package/src/components/NavInternal/NavInternalPanel.js +88 -0
- package/src/components/NavInternal/NavInternalPanel.stories.js +248 -0
- package/src/components/NavInternal/NavInternalSection.js +47 -0
- package/src/components/NavInternal/NavInternalSection.stories.js +55 -0
- package/src/components/SearchInput/SearchInput.js +44 -0
- package/src/components/SearchInput/SearchInput.stories.js +30 -0
- package/src/main.js +6 -0
- package/stylelint.config.js +60 -0
- package/tailwind.config.js +19 -0
- package/tsconfig.json +23 -0
- package/vite.config.js +25 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const LogoJPLTemplate = ({ colorClass }) => {
|
|
2
|
+
if (!colorClass) colorClass = 'text-jpl-red'
|
|
3
|
+
return `
|
|
4
|
+
<svg
|
|
5
|
+
class="LogoJPL ${colorClass}"
|
|
6
|
+
width="74"
|
|
7
|
+
height="22"
|
|
8
|
+
viewBox="0 0 74 22"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
aria-hidden="true"
|
|
12
|
+
focusable="false"
|
|
13
|
+
>
|
|
14
|
+
<path d="M14.598 0v14.804a1.36 1.36 0 0 1-1.336 1.336H2.982L0 21.897h16.757c2.673 0 5.037-2.775 5.037-5.346V0h-7.196zM70.317 16.14H60.14a1.36 1.36 0 0 1-1.337-1.336V0h-7.196v16.551c0 2.57 2.365 5.346 5.038 5.346h16.757l-3.085-5.757zM49.037 3.495C47.907 1.336 45.542 0 43.075 0H23.747v22h7.197V5.757h9.663c1.337 0 2.468 1.13 2.468 2.467 0 1.337-1.131 2.468-2.468 2.468h-9.663l2.981 5.757h9.047c2.467 0 4.729-1.337 5.962-3.496.412-.72.72-1.439.925-2.261.206-.823.309-1.645.309-2.468 0-.822-.103-1.645-.309-2.467-.102-.822-.41-1.542-.822-2.262z" fill="currentColor"/>
|
|
15
|
+
</svg>
|
|
16
|
+
`
|
|
17
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LogoJPLTemplate } from './LogoJPL'
|
|
2
|
+
|
|
3
|
+
const Stories = {
|
|
4
|
+
title: 'Foundation/Logos/LogoJPL',
|
|
5
|
+
tags: ['!autodocs'],
|
|
6
|
+
excludeStories: /.*Data$/,
|
|
7
|
+
argTypes: {
|
|
8
|
+
colorClass: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Only a few color options are allowed.',
|
|
11
|
+
control: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
options: ['text-jpl-red', 'text-black', 'text-white']
|
|
14
|
+
},
|
|
15
|
+
table: {
|
|
16
|
+
defaultValue: { summary: 'text-jpl-red' }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
parameters: {
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component: `The JPL Logo has strict color usage restrictions and should only be used on internal sites, namely in the [AppBar](?path=/docs/global-layout-headers-for-internal-sites-elements-overview--docs).`
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const Default = LogoJPLTemplate.bind({})
|
|
30
|
+
Default.storyName = 'Standard'
|
|
31
|
+
Default.args = { colorClass: 'text-jpl-red' }
|
|
32
|
+
|
|
33
|
+
export const Black = LogoJPLTemplate.bind({})
|
|
34
|
+
Black.args = { colorClass: 'text-black' }
|
|
35
|
+
|
|
36
|
+
export const White = LogoJPLTemplate.bind({})
|
|
37
|
+
White.args = { colorClass: 'text-white' }
|
|
38
|
+
White.decorators = [(Story) => `<div class="p-5 bg-black">${Story()}</div>`]
|
|
39
|
+
|
|
40
|
+
export default Stories
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const MixinAnimationCaretTemplate = ({ text, customClass }) => {
|
|
2
|
+
if (!customClass) customClass = ''
|
|
3
|
+
return `
|
|
4
|
+
<span class="MixinAnimationCaret ${customClass}">
|
|
5
|
+
<span>${text}</span>
|
|
6
|
+
<span aria-hidden="true" class="arrow-wrapper text-action ml-1">
|
|
7
|
+
<span class="arrow">
|
|
8
|
+
<svg
|
|
9
|
+
width="8"
|
|
10
|
+
height="14"
|
|
11
|
+
viewBox="0 0 8 14"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
focusable="false"
|
|
15
|
+
class="IconCaret"
|
|
16
|
+
>
|
|
17
|
+
<path
|
|
18
|
+
d="M7.864 7.004L1.5 13.368.086 11.954l4.948-4.95-4.948-4.95L1.5.64l6.364 6.364z"
|
|
19
|
+
fill="currentColor"
|
|
20
|
+
></path>
|
|
21
|
+
</svg>
|
|
22
|
+
</span>
|
|
23
|
+
<span class="arrow-fixed">
|
|
24
|
+
<svg
|
|
25
|
+
width="8"
|
|
26
|
+
height="14"
|
|
27
|
+
viewBox="0 0 8 14"
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
focusable="false"
|
|
31
|
+
class="IconCaret"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
d="M7.864 7.004L1.5 13.368.086 11.954l4.948-4.95-4.948-4.95L1.5.64l6.364 6.364z"
|
|
35
|
+
fill="currentColor"
|
|
36
|
+
></path>
|
|
37
|
+
</svg>
|
|
38
|
+
</span>
|
|
39
|
+
</span>
|
|
40
|
+
</span>
|
|
41
|
+
`
|
|
42
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MixinAnimationCaretTemplate } from './MixinAnimationCaret.js'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Mixins/MixinAnimationCaret',
|
|
5
|
+
argTypes: {
|
|
6
|
+
text: {
|
|
7
|
+
type: 'string',
|
|
8
|
+
description: 'Text or html markup'
|
|
9
|
+
},
|
|
10
|
+
inline: {
|
|
11
|
+
type: 'boolean',
|
|
12
|
+
description: 'Inline option',
|
|
13
|
+
control: {
|
|
14
|
+
type: 'boolean'
|
|
15
|
+
},
|
|
16
|
+
table: {
|
|
17
|
+
defaultValue: { summary: 'false' }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
parameters: {
|
|
22
|
+
viewMode: 'docs',
|
|
23
|
+
docs: {
|
|
24
|
+
description: {
|
|
25
|
+
component:
|
|
26
|
+
'This mixin appends an animated caret to a line of text or to more complex HTML markup. When implemented, it must be wrapped by a link element with CSS class `group` to ensure that the animation is triggered by hovering over the link. See the `BaseLink` primary variant for an implementation example. '
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Default = MixinAnimationCaretTemplate.bind({})
|
|
33
|
+
Default.args = { text: 'Hover for animation', inline: false }
|
|
34
|
+
|
|
35
|
+
export const Inline = MixinAnimationCaretTemplate.bind({})
|
|
36
|
+
Inline.args = { text: 'Longer text to demonstrate text wrap', inline: true }
|
|
37
|
+
Inline.decorators = [(Story) => `<div id="storyRoot" class="w-64">${Story()}</div>`]
|
|
38
|
+
Inline.parameters = {
|
|
39
|
+
html: {
|
|
40
|
+
root: '#storyRoot'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { SearchInputTemplate } from '../SearchInput/SearchInput'
|
|
2
|
+
import { IconCloseTemplate } from '../Icons/IconClose'
|
|
3
|
+
import { IconDropdownTemplate } from '../Icons/IconDropdown'
|
|
4
|
+
import { IconExternalTemplate } from '../Icons/IconExternal'
|
|
5
|
+
import { IconSearchTemplate } from '../Icons/IconSearch'
|
|
6
|
+
import { NavInternalPanelTemplate } from '../NavInternal/NavInternalPanel'
|
|
7
|
+
|
|
8
|
+
export const NavInternalTemplate = ({ includeSearch, menuItems }) => {
|
|
9
|
+
if (includeSearch == undefined) includeSearch = false
|
|
10
|
+
if (!menuItems) menuItems = []
|
|
11
|
+
|
|
12
|
+
let menuItemsTemplate = ''
|
|
13
|
+
if (menuItems.length > 0) {
|
|
14
|
+
for (const [index, item] of menuItems.entries()) {
|
|
15
|
+
const isMegaMenu =
|
|
16
|
+
(item.menuItems && item.menuItems.length > 0) ||
|
|
17
|
+
(item.highlights && item.highlights.length > 0)
|
|
18
|
+
? true
|
|
19
|
+
: false
|
|
20
|
+
|
|
21
|
+
menuItemsTemplate += `<li class="${item.isActive ? 'active' : ''}">
|
|
22
|
+
${
|
|
23
|
+
isMegaMenu
|
|
24
|
+
? `
|
|
25
|
+
<button class="toggle-NavInternalPanel flex flex-nowrap items-center w-full lg:w-auto font-text tracking-[-.03rem]"
|
|
26
|
+
id="ddtoggle_${item.id}"
|
|
27
|
+
aria-haspopup="true"
|
|
28
|
+
aria-expanded="false"
|
|
29
|
+
>
|
|
30
|
+
<span class="pointer-events-none" data-text="${item.title}">
|
|
31
|
+
${item.title}
|
|
32
|
+
</span>
|
|
33
|
+
${IconDropdownTemplate({})}
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
<div class="panel-wrapper lg:absolute inset-0 spacer z-0 invisible">
|
|
37
|
+
<!-- Insert NavInternalPanel here -->${NavInternalPanelTemplate({
|
|
38
|
+
id: item.id,
|
|
39
|
+
title: item.title,
|
|
40
|
+
url: item.url,
|
|
41
|
+
isActive: item.isActive,
|
|
42
|
+
repeatInPanel: item.repeatInPanel,
|
|
43
|
+
repeatedTitle: item.repeatedTitle,
|
|
44
|
+
highlights: item.highlights,
|
|
45
|
+
menuItems: item.menuItems,
|
|
46
|
+
allowSectionBreaks: item.allowSectionBreaks,
|
|
47
|
+
allowSectionColumns: item.allowSectionColumns
|
|
48
|
+
})}<!-- End NavInternalPanel -->
|
|
49
|
+
</div>
|
|
50
|
+
`
|
|
51
|
+
: `
|
|
52
|
+
<a href="${item.url}" class="block font-text tracking-[-.03rem]"${
|
|
53
|
+
item.url.startsWith('h') ? ` target="_blank" rel="noopener"` : ''
|
|
54
|
+
}>
|
|
55
|
+
<span class="inline-block" data-text="${item.title}">
|
|
56
|
+
${item.title}
|
|
57
|
+
</span>
|
|
58
|
+
${
|
|
59
|
+
item.url.startsWith('h')
|
|
60
|
+
? ` <span class="text-xs ml-1">
|
|
61
|
+
${IconExternalTemplate({})}
|
|
62
|
+
</span>`
|
|
63
|
+
: ''
|
|
64
|
+
}
|
|
65
|
+
</a>
|
|
66
|
+
`
|
|
67
|
+
}
|
|
68
|
+
</li>
|
|
69
|
+
`
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return `
|
|
74
|
+
<div id="NavInternalContainer" class="bg-white lg:block hidden">
|
|
75
|
+
<nav class="NavInternal" aria-label="Main">
|
|
76
|
+
${
|
|
77
|
+
includeSearch
|
|
78
|
+
? `<div class="flex lg:hidden">
|
|
79
|
+
<form id="NavMobileSearchForm" action="#" method="get" class="pt-6 pb-4 px-4 w-full">
|
|
80
|
+
${SearchInputTemplate({
|
|
81
|
+
inputId: 'NavMobileSearchInput',
|
|
82
|
+
compact: false
|
|
83
|
+
})}
|
|
84
|
+
</form>
|
|
85
|
+
</div>`
|
|
86
|
+
: ''
|
|
87
|
+
}
|
|
88
|
+
<div class="w-full relative lg:shadow-lg z-20 bg-white">
|
|
89
|
+
<div class="lg:container mx-auto lg:flex justify-between">
|
|
90
|
+
<ul class="top-level lg:flex flex-nowrap lg:overflow-x-auto ${
|
|
91
|
+
!includeSearch ? 'pt-6 lg:pt-0' : ''
|
|
92
|
+
}">
|
|
93
|
+
${menuItemsTemplate}
|
|
94
|
+
</ul>
|
|
95
|
+
${
|
|
96
|
+
includeSearch
|
|
97
|
+
? `<div class="hidden lg:block border-t-3 border-transparent relative z-10">
|
|
98
|
+
<button id="NavSearchOpen" aria-label="Open search" class="flex flex-nowrap items-center py-6 px-1 border-b-3 can-hover:hover:text-gray-mid-dark focus:border-gray-dark/20 focus:outline-none border-transparent">
|
|
99
|
+
<span class="font-text font-medium leading-tight tracking-[-.03rem] pr-2">
|
|
100
|
+
Search
|
|
101
|
+
</span>
|
|
102
|
+
${IconSearchTemplate({})}
|
|
103
|
+
</button>
|
|
104
|
+
</div>`
|
|
105
|
+
: ''
|
|
106
|
+
}
|
|
107
|
+
</div>
|
|
108
|
+
${
|
|
109
|
+
includeSearch
|
|
110
|
+
? `<div id="NavSearchContainer" class="hidden absolute inset-0 bg-white z-10">
|
|
111
|
+
<div class="BaseGrid container mx-auto h-full">
|
|
112
|
+
<div class="indent-col-base indent-col-2 px-4">
|
|
113
|
+
<div class="flex flex-row items-center h-full pb-2">
|
|
114
|
+
<form id="NavDesktopSearchForm" action="#" method="get" class="flex-grow">
|
|
115
|
+
${SearchInputTemplate({
|
|
116
|
+
inputId: 'NavSearchInput',
|
|
117
|
+
compact: true,
|
|
118
|
+
placeholder: 'Search this site…'
|
|
119
|
+
})}
|
|
120
|
+
</form>
|
|
121
|
+
<button id="NavSearchClose" aria-label="Close search" class="flex flex-nowrap shrink-0 items-center p-2 text-black text-xs focus:outline-none focus:ring-2">
|
|
122
|
+
${IconCloseTemplate({})}
|
|
123
|
+
</button>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>`
|
|
128
|
+
: ''
|
|
129
|
+
}
|
|
130
|
+
</div>
|
|
131
|
+
</nav>
|
|
132
|
+
<div id="NavBgOverlay" class="fixed z-0 inset-0 hidden lg:block opacity-80 bg-black invisible-overlay"></div>
|
|
133
|
+
<div class="bg-white fixed inset-0 lg:hidden z-0"></div>
|
|
134
|
+
`
|
|
135
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NavInternalTemplate } from './NavInternal'
|
|
2
|
+
import {
|
|
3
|
+
NavInternalPanelBasicData,
|
|
4
|
+
NavInternalPanelNoHighlightsData,
|
|
5
|
+
NavInternalPanelAllHighlightsData,
|
|
6
|
+
NavInternalPanelWithHeadingsData,
|
|
7
|
+
NavInternalPanelCombinationData
|
|
8
|
+
} from './NavInternalPanel.stories'
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: 'Internal Header/Elements/Navigation',
|
|
12
|
+
excludeStories: /.*Data$/,
|
|
13
|
+
parameters: {
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
layout: 'fullscreen',
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component:
|
|
19
|
+
'Navigation with mega-menu dropdowns. Note: mobile view will only work when used with the [Internal Header](https://nasa-jpl.github.io/explorer-1/?path=/docs/global-layout-headers-for-internal-sites--docs).'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
html: {
|
|
23
|
+
root: '#storyRoot'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
decorators: [(Story) => `<div id="storyRoot">${Story()}</div>`]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const NavInternalData = {
|
|
30
|
+
includeSearch: true,
|
|
31
|
+
menuItems: [
|
|
32
|
+
{
|
|
33
|
+
id: 1,
|
|
34
|
+
title: 'Home',
|
|
35
|
+
url: '#'
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 2,
|
|
39
|
+
isActive: true,
|
|
40
|
+
...NavInternalPanelBasicData
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: 3,
|
|
44
|
+
...NavInternalPanelNoHighlightsData
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 4,
|
|
48
|
+
...NavInternalPanelAllHighlightsData
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 5,
|
|
52
|
+
...NavInternalPanelWithHeadingsData
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 6,
|
|
56
|
+
...NavInternalPanelCombinationData
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 7,
|
|
60
|
+
title: 'External',
|
|
61
|
+
url: 'https://www.jpl.nasa.gov/'
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Default = NavInternalTemplate.bind({})
|
|
67
|
+
Default.storyName = 'Navigation'
|
|
68
|
+
Default.args = NavInternalData
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { BaseImagePlaceholderTemplate } from '../BaseImagePlaceholder/BaseImagePlaceholder'
|
|
2
|
+
|
|
3
|
+
export const NavInternalHighlightTemplate = ({ title, description, image, link, ariaLabel }) => {
|
|
4
|
+
// set defaults
|
|
5
|
+
if (!title) title = ''
|
|
6
|
+
if (!description) description = ''
|
|
7
|
+
if (!image) image = {}
|
|
8
|
+
if (!link) link = ''
|
|
9
|
+
if (!ariaLabel) ariaLabel = ''
|
|
10
|
+
|
|
11
|
+
return `<div class="NavInternalHighlight mb-6 lg:mb-0 lg:w-5/6">
|
|
12
|
+
${
|
|
13
|
+
title
|
|
14
|
+
? `<p class="font-display font-medium text-2xl lg:text-xl xl:text-2xl mb-4">
|
|
15
|
+
${title}
|
|
16
|
+
</p>`
|
|
17
|
+
: ''
|
|
18
|
+
}
|
|
19
|
+
${
|
|
20
|
+
description
|
|
21
|
+
? `<p class="text-sm font-secondary -tracking-[0.03rem] leading-normal ${image ? 'mb-4 lg:mb-6' : ''}">
|
|
22
|
+
${description}
|
|
23
|
+
</p>`
|
|
24
|
+
: ''
|
|
25
|
+
}
|
|
26
|
+
${
|
|
27
|
+
image && image.src && link
|
|
28
|
+
? `
|
|
29
|
+
<a
|
|
30
|
+
class="block group cursor-hover text-jpl-teal-dark can-hover:hover:jpl-teal font-medium lg:font-normal"
|
|
31
|
+
href="${link}"
|
|
32
|
+
${ariaLabel ? `aria-label="${ariaLabel}"` : ''}
|
|
33
|
+
>
|
|
34
|
+
`
|
|
35
|
+
: ''
|
|
36
|
+
}
|
|
37
|
+
${
|
|
38
|
+
image && image.src
|
|
39
|
+
? `${BaseImagePlaceholderTemplate({
|
|
40
|
+
wrapperClass: 'hidden lg:block bg-gray-dark relative overflow-hidden',
|
|
41
|
+
theme: 'dark-theme',
|
|
42
|
+
aspectRatio: 'aspect-ratio-sixteen-nine',
|
|
43
|
+
noLogo: true,
|
|
44
|
+
objectFitClass: 'object-cover',
|
|
45
|
+
imageClass:
|
|
46
|
+
'can-hover:group-hover:delay-200 can-hover:group-hover:scale-100 absolute top-0 left-0 w-full transition-all duration-200 ease-in scale-105',
|
|
47
|
+
src: image.src,
|
|
48
|
+
width: image.width,
|
|
49
|
+
height: image.height,
|
|
50
|
+
alt: image.alt
|
|
51
|
+
})}
|
|
52
|
+
${
|
|
53
|
+
link
|
|
54
|
+
? `<span class="block lg:hidden">
|
|
55
|
+
${title}
|
|
56
|
+
</span>
|
|
57
|
+
</a>`
|
|
58
|
+
: ''
|
|
59
|
+
}`
|
|
60
|
+
: ''
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
`
|
|
64
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NavInternalHighlightTemplate } from './NavInternalHighlight'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Internal Header/Elements/Highlight',
|
|
5
|
+
excludeStories: /.*Data$/,
|
|
6
|
+
parameters: {
|
|
7
|
+
viewMode: 'docs',
|
|
8
|
+
docs: {
|
|
9
|
+
description: {
|
|
10
|
+
component:
|
|
11
|
+
'Highlighted content intended for use within [NavInternalPanel](https://nasa-jpl.github.io/explorer-1/?path=/docs/global-layout-headers-for-internal-sites-elements-panel--basic) '
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
html: {
|
|
15
|
+
root: '#storyRoot'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
decorators: [(Story) => `<div id="storyRoot" class="NavInternal w-96">${Story()}</div>`]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const NavInternalHighlightData = {
|
|
22
|
+
title: 'A Highlight',
|
|
23
|
+
description: 'Lorem ipsum dolor sit amet consectatur adipscing',
|
|
24
|
+
image: {
|
|
25
|
+
src: 'http://picsum.photos/512/288',
|
|
26
|
+
width: '512',
|
|
27
|
+
height: '288',
|
|
28
|
+
alt: 'Alt text'
|
|
29
|
+
},
|
|
30
|
+
link: '#',
|
|
31
|
+
ariaLabel: 'Go to this Highlight'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Default = NavInternalHighlightTemplate.bind({})
|
|
35
|
+
Default.storyName = 'Highlight'
|
|
36
|
+
Default.args = NavInternalHighlightData
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { NavInternalHighlightTemplate } from '../NavInternal/NavInternalHighlight'
|
|
2
|
+
import { NavInternalSectionTemplate } from '../NavInternal/NavInternalSection'
|
|
3
|
+
|
|
4
|
+
export const NavInternalPanelTemplate = ({
|
|
5
|
+
id,
|
|
6
|
+
title,
|
|
7
|
+
url,
|
|
8
|
+
isActive,
|
|
9
|
+
repeatInPanel,
|
|
10
|
+
repeatedTitle,
|
|
11
|
+
highlights,
|
|
12
|
+
menuItems,
|
|
13
|
+
allowSectionBreaks,
|
|
14
|
+
allowSectionColumns
|
|
15
|
+
}) => {
|
|
16
|
+
// set defaults
|
|
17
|
+
if (!id) id = (Math.random() + 1).toString(36).substring(7)
|
|
18
|
+
if (!title) title = ''
|
|
19
|
+
if (!url) url = ''
|
|
20
|
+
if (isActive == undefined) isActive = false
|
|
21
|
+
if (repeatInPanel == undefined) repeatInPanel = false
|
|
22
|
+
if (!repeatedTitle) repeatedTitle = ''
|
|
23
|
+
if (!highlights) highlights = []
|
|
24
|
+
if (!menuItems) menuItems = []
|
|
25
|
+
if (allowSectionBreaks == undefined) allowSectionBreaks = true
|
|
26
|
+
if (allowSectionColumns == undefined) allowSectionColumns = true
|
|
27
|
+
|
|
28
|
+
const repeatedItemTemplate = repeatInPanel
|
|
29
|
+
? `<div class="repeated-item col-span-full mb-6 lg:mb-4">
|
|
30
|
+
<a href="${url}" class="inline-block p-2 -mt-2 -ml-2 -mb-2 ${isActive ? 'active' : ''}">
|
|
31
|
+
<span>
|
|
32
|
+
${repeatedTitle.length > 0 ? repeatedTitle : title}
|
|
33
|
+
</span>
|
|
34
|
+
</a>
|
|
35
|
+
</div>`
|
|
36
|
+
: ''
|
|
37
|
+
let highlightsTemplate = ''
|
|
38
|
+
if (highlights.length > 0) {
|
|
39
|
+
for (const [index, item] of highlights.entries()) {
|
|
40
|
+
highlightsTemplate += NavInternalHighlightTemplate({
|
|
41
|
+
title: item.title,
|
|
42
|
+
description: item.description,
|
|
43
|
+
image: item.image,
|
|
44
|
+
link: item.link,
|
|
45
|
+
ariaLabel: item.ariaLabel
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let sectionsTemplate = ''
|
|
50
|
+
if (menuItems.length > 0) {
|
|
51
|
+
sectionsTemplate = ` <div class="lg:mt-0 ${
|
|
52
|
+
!allowSectionColumns
|
|
53
|
+
? 'no-auto-cols'
|
|
54
|
+
: `${
|
|
55
|
+
highlights.length == 1
|
|
56
|
+
? 'mt-6 col-span-2 lg:auto-cols-2'
|
|
57
|
+
: highlights.length == 2
|
|
58
|
+
? 'mt-6 col-span-1 no-auto-cols'
|
|
59
|
+
: highlights.length == 3 || highlights.length == 0
|
|
60
|
+
? 'col-span-3 lg:auto-cols-3'
|
|
61
|
+
: ''
|
|
62
|
+
}`
|
|
63
|
+
}">`
|
|
64
|
+
for (const [index, section] of menuItems.entries()) {
|
|
65
|
+
sectionsTemplate += NavInternalSectionTemplate({
|
|
66
|
+
title: section.title,
|
|
67
|
+
url: section.url,
|
|
68
|
+
menuItems: section.menuItems,
|
|
69
|
+
isActive: section.isActive
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
sectionsTemplate += `</div>`
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return `
|
|
76
|
+
<div id="target_ddtoggle_${id}" class="NavInternalPanel w-full lg:shadow px-10 py-8 lg:px-0 lg:py-10 ${
|
|
77
|
+
allowSectionBreaks ? 'allow-breaks' : ''
|
|
78
|
+
}">
|
|
79
|
+
<div class="lg:container mx-auto">
|
|
80
|
+
<div class="lg:grid lg:grid-cols-3 gap-14 gap-y-0 lg:px-12">
|
|
81
|
+
${repeatedItemTemplate}
|
|
82
|
+
${highlightsTemplate}
|
|
83
|
+
${sectionsTemplate}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
88
|
+
}
|