@hashicorp/react-components 0.0.0-nightly.e8ac55b → 0.0.0-nightly.ed6ac6e
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 +8 -5
- package/src/components/marketo-form/partials/fields/htmltext-field/style.module.css +16 -4
- package/src/components/marketo-form/utils.ts +4 -0
- package/src/components/nav-panel/components/link-list/index.tsx +89 -0
- package/src/components/nav-panel/components/link-list/style.module.css +57 -0
- package/src/components/nav-panel/components/panel/column/index.tsx +24 -0
- package/src/components/nav-panel/components/panel/column/style.module.css +24 -0
- package/src/components/nav-panel/components/panel/index.tsx +4 -0
- package/src/components/nav-panel/components/panel/root/index.tsx +20 -0
- package/src/components/nav-panel/components/panel/root/style.module.css +30 -0
- package/src/components/nav-panel/components/promo/index.tsx +86 -0
- package/src/components/nav-panel/components/promo/style.module.css +114 -0
- package/src/components/nav-panel/index.tsx +6 -0
- package/src/components/nav-panel/product-panel/index.tsx +165 -0
- package/src/components/nav-panel/product-panel/style.module.css +315 -0
- package/src/components/nav-panel/standard-panel/index.tsx +44 -0
- package/src/components/nav-panel/standard-panel/style.module.css +11 -0
- package/src/components/next-steps/index.tsx +4 -10
- package/src/components/subnav/index.tsx +7 -7
- package/src/components/subnav/partials/CtaLinks/github-stars-link/style.module.css +8 -12
- package/src/components/subnav/partials/CtaLinks/index.tsx +1 -1
- package/src/components/subnav/partials/CtaLinks/style.module.css +4 -4
- package/src/components/subnav/partials/DropdownTrigger/index.tsx +2 -2
- package/src/components/subnav/partials/DropdownTrigger/style.module.css +7 -4
- package/src/components/subnav/partials/MenuItemsDefault/index.tsx +11 -4
- package/src/components/subnav/partials/MenuItemsDefault/style.module.css +37 -24
- package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +9 -5
- package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +22 -16
- package/src/components/subnav/partials/TitleLink/index.tsx +10 -10
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +9 -8
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +9 -8
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-dark.ts +10 -10
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-light.ts +10 -10
- package/src/components/subnav/partials/TitleLink/style.module.css +1 -1
- package/src/components/subnav/partials/nav-item-text/style.module.css +2 -4
- package/src/components/subnav/style.module.css +3 -5
- package/src/lib/parse-url/index.test.ts +35 -0
- package/src/lib/parse-url/index.ts +32 -0
- package/src/lib/track-nav-click-event/index.ts +22 -0
- package/src/lib/v/index.ts +10 -0
- package/src/components/subnav/theme.module.css +0 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashicorp/react-components",
|
|
3
|
-
"version": "0.0.0-nightly.
|
|
3
|
+
"version": "0.0.0-nightly.ed6ac6e",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "next-hashicorp lint",
|
|
@@ -8,20 +8,23 @@
|
|
|
8
8
|
"test:watch": "vitest watch"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hashicorp/flight-icons": "^
|
|
11
|
+
"@hashicorp/flight-icons": "^3.5.0",
|
|
12
12
|
"@hashicorp/platform-product-meta": "^0.1.1",
|
|
13
13
|
"@hashicorp/platform-util": "^0.2.0",
|
|
14
14
|
"@hashicorp/react-design-system-components": "*",
|
|
15
|
-
"@
|
|
15
|
+
"@hashicorp/web-mktg-logos": "*",
|
|
16
|
+
"@radix-ui/react-navigation-menu": "^1.2.0",
|
|
17
|
+
"@radix-ui/react-visually-hidden": "^1.1.0",
|
|
18
|
+
"@vercel/analytics": "^1.3.1",
|
|
16
19
|
"@vercel/fetch": "^7.0.0",
|
|
17
|
-
"@
|
|
20
|
+
"@vercel/stega": "^0.1.2",
|
|
18
21
|
"classnames": "^2.3.2",
|
|
19
22
|
"js-cookie": "^3.0.5",
|
|
20
23
|
"moize": "^6.1.3",
|
|
21
24
|
"react-hook-form": "^7.43.5"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
|
-
"@hashicorp/platform-cli": "^2.
|
|
27
|
+
"@hashicorp/platform-cli": "^2.8.0",
|
|
25
28
|
"@hashicorp/platform-types": "^0.4.0",
|
|
26
29
|
"@testing-library/jest-dom": "^6.4.2",
|
|
27
30
|
"@vitejs/plugin-react": "^4.2.1",
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
.htmltext {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
composes: g-type-body-small from global;
|
|
3
|
+
margin-top: var(--hdsplus-spacing-04);
|
|
4
|
+
margin-bottom: var(--hdsplus-spacing-07);
|
|
5
|
+
color: var(--token-color-foreground-faint);
|
|
6
|
+
|
|
7
|
+
& a {
|
|
8
|
+
color: var(--token-color-foreground-action);
|
|
9
|
+
text-decoration: underline;
|
|
10
|
+
|
|
11
|
+
&:focus-visible {
|
|
12
|
+
text-decoration: none;
|
|
13
|
+
border-radius: 2px;
|
|
14
|
+
outline: 2px solid var(--token-color-focus-action-internal);
|
|
15
|
+
outline-offset: 1px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
6
18
|
}
|
|
@@ -426,6 +426,10 @@ export const resolverErrors = (
|
|
|
426
426
|
* @returns MarketoFormField[] with columnSplit property set
|
|
427
427
|
*/
|
|
428
428
|
export function setFieldsColumnSplit(fieldsArr: MarketoFormField[]) {
|
|
429
|
+
if (!fieldsArr) {
|
|
430
|
+
return []
|
|
431
|
+
}
|
|
432
|
+
|
|
429
433
|
return fieldsArr.map((f) => {
|
|
430
434
|
const columnSplit = getFieldColumnSplit(fieldsArr, f)
|
|
431
435
|
return { ...f, columnSplit }
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import Link from 'next/link'
|
|
2
|
+
import { parseUrl } from '../../../../lib/parse-url'
|
|
3
|
+
import { vercelSplit } from '../../../../lib/v'
|
|
4
|
+
import FlightIcon from '@hashicorp/react-design-system-components/src/components/flight-icon'
|
|
5
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
6
|
+
import s from './style.module.css'
|
|
7
|
+
|
|
8
|
+
export interface LinkListProps {
|
|
9
|
+
links: {
|
|
10
|
+
title: string
|
|
11
|
+
url: string
|
|
12
|
+
icon?: string
|
|
13
|
+
description?: string
|
|
14
|
+
iconGradient?: string
|
|
15
|
+
}[]
|
|
16
|
+
linkClickHandler?: (title: string, url: string) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const GRADIENT_VALUE_MAP = new Map([
|
|
20
|
+
[
|
|
21
|
+
'ILM',
|
|
22
|
+
{
|
|
23
|
+
iconGradient: 'var(--icon-gradient-infrastructure-lifecycle-management)',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
'SLM',
|
|
28
|
+
{
|
|
29
|
+
iconGradient: 'var(--icon-gradient-security-lifecycle-management)',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
'Cloud',
|
|
34
|
+
{
|
|
35
|
+
iconGradient: 'var(--icon-gradient-infrastructure-cloud)',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
])
|
|
39
|
+
|
|
40
|
+
export default function LinkList({ links, linkClickHandler }: LinkListProps) {
|
|
41
|
+
return (
|
|
42
|
+
<ul className={s.linkList}>
|
|
43
|
+
{links.map((link) => {
|
|
44
|
+
let style
|
|
45
|
+
link.iconGradient
|
|
46
|
+
? (style = {
|
|
47
|
+
'--iconGradient': GRADIENT_VALUE_MAP.get(
|
|
48
|
+
vercelSplit(link.iconGradient)
|
|
49
|
+
)?.iconGradient,
|
|
50
|
+
} as React.CSSProperties)
|
|
51
|
+
: (style = null)
|
|
52
|
+
return (
|
|
53
|
+
<li key={link.title}>
|
|
54
|
+
<NavigationMenu.Link asChild>
|
|
55
|
+
<Link
|
|
56
|
+
className={s.link}
|
|
57
|
+
href={parseUrl(link.url).href}
|
|
58
|
+
onClickCapture={() => {
|
|
59
|
+
linkClickHandler && linkClickHandler(link.title, link.url)
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
{link.iconGradient && link.icon ? (
|
|
63
|
+
<div className={s.iconBackground} style={style}>
|
|
64
|
+
<FlightIcon name={vercelSplit(link.icon)} />
|
|
65
|
+
</div>
|
|
66
|
+
) : (
|
|
67
|
+
link.icon && (
|
|
68
|
+
<FlightIcon
|
|
69
|
+
name={vercelSplit(link.icon)}
|
|
70
|
+
color="var(--token-color-foreground-faint)"
|
|
71
|
+
/>
|
|
72
|
+
)
|
|
73
|
+
)}
|
|
74
|
+
<div>
|
|
75
|
+
<div className={link.iconGradient && s.boldTitle}>
|
|
76
|
+
{link.title}
|
|
77
|
+
</div>
|
|
78
|
+
{link.description && (
|
|
79
|
+
<div className={s.description}>{link.description}</div>
|
|
80
|
+
)}
|
|
81
|
+
</div>
|
|
82
|
+
</Link>
|
|
83
|
+
</NavigationMenu.Link>
|
|
84
|
+
</li>
|
|
85
|
+
)
|
|
86
|
+
})}
|
|
87
|
+
</ul>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.linkList {
|
|
2
|
+
display: flex;
|
|
3
|
+
list-style: none;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--hdsplus-spacing-03);
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.link {
|
|
11
|
+
color: var(--token-color-foreground-primary);
|
|
12
|
+
display: flex;
|
|
13
|
+
gap: var(--hdsplus-spacing-04);
|
|
14
|
+
padding: var(--hdsplus-spacing-03) var(--hdsplus-spacing-04);
|
|
15
|
+
min-width: 190px;
|
|
16
|
+
align-items: center;
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: var(--token-color-surface-interactive-hover);
|
|
20
|
+
border-radius: var(--hdsplus-spacing-01);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&:has(.iconBackground) {
|
|
24
|
+
align-items: flex-start;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (--large) {
|
|
28
|
+
max-width: 416px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:focus {
|
|
32
|
+
outline: 2px solid var(--token-color-focus-action-internal);
|
|
33
|
+
outline-style: auto;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.description {
|
|
38
|
+
font-size: var(--hdsplus-typography-body-200-font-size);
|
|
39
|
+
font-weight: var(--token-typography-font-weight-regular);
|
|
40
|
+
margin-top: var(--hdsplus-spacing-02);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.iconBackground {
|
|
44
|
+
background: var(--iconGradient);
|
|
45
|
+
height: var(--hdsplus-spacing-08);
|
|
46
|
+
width: var(--hdsplus-spacing-08);
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
border-radius: 3px;
|
|
51
|
+
flex: none;
|
|
52
|
+
margin-top: 3px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.boldTitle {
|
|
56
|
+
font-weight: var(--font-weight-semi-bold);
|
|
57
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import s from './style.module.css'
|
|
3
|
+
|
|
4
|
+
export interface NavColumnProps {
|
|
5
|
+
className?: string
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
hasSidePanel?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Column({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
hasSidePanel,
|
|
14
|
+
}: NavColumnProps) {
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
className={classNames(s.column, className, {
|
|
18
|
+
[s.hasSide]: hasSidePanel,
|
|
19
|
+
})}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</div>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
|
+
|
|
3
|
+
.column {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
justify-content: flex-start;
|
|
8
|
+
min-width: 190px;
|
|
9
|
+
padding: 0;
|
|
10
|
+
margin: 0 var(--hdsplus-spacing-07);
|
|
11
|
+
border-radius: var(--hdsplus-spacing-03);
|
|
12
|
+
|
|
13
|
+
@media (--large) {
|
|
14
|
+
&:not(.hasSide) {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (--dev-dot-viewport) {
|
|
20
|
+
&.hasSide {
|
|
21
|
+
margin: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import s from './style.module.css'
|
|
3
|
+
|
|
4
|
+
interface RootProps {
|
|
5
|
+
className?: string
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
hasSidePanel?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function Root({ className, children, hasSidePanel }: RootProps) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
className={classNames(s.root, className, {
|
|
14
|
+
[s.hasSide]: hasSidePanel,
|
|
15
|
+
})}
|
|
16
|
+
>
|
|
17
|
+
{children}
|
|
18
|
+
</div>
|
|
19
|
+
)
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
width: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
/* stylelint-disable-next-line unit-no-unknown */
|
|
9
|
+
min-height: calc(100dvh - var(--hdsplus-spacing-12));
|
|
10
|
+
|
|
11
|
+
@media (--large) {
|
|
12
|
+
&:not(.hasSide) {
|
|
13
|
+
justify-content: flex-start;
|
|
14
|
+
height: 100%;
|
|
15
|
+
min-height: fit-content;
|
|
16
|
+
padding: var(--hdsplus-spacing-05) var(--hdsplus-spacing-04);
|
|
17
|
+
gap: var(--hdsplus-spacing-04);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (--dev-dot-viewport) {
|
|
22
|
+
&.hasSide {
|
|
23
|
+
justify-content: flex-start;
|
|
24
|
+
height: 100%;
|
|
25
|
+
min-height: fit-content;
|
|
26
|
+
padding: var(--hdsplus-spacing-05) var(--hdsplus-spacing-04);
|
|
27
|
+
gap: var(--hdsplus-spacing-04);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useCallback } from 'react'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
import { vercelSplit } from '../../../../lib/v'
|
|
4
|
+
import Link from 'next/link'
|
|
5
|
+
import { parseUrl } from '../../../../lib/parse-url'
|
|
6
|
+
import { trackNavClickEvent } from '../../../../lib/track-nav-click-event'
|
|
7
|
+
import FlightIcon from '@hashicorp/react-design-system-components/src/components/flight-icon'
|
|
8
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
9
|
+
import s from './style.module.css'
|
|
10
|
+
|
|
11
|
+
export interface PromoProps {
|
|
12
|
+
title: string
|
|
13
|
+
description: string
|
|
14
|
+
linkUrl: string
|
|
15
|
+
linkTitle: string
|
|
16
|
+
slug?: string
|
|
17
|
+
icon?: string
|
|
18
|
+
theme: string
|
|
19
|
+
hasSidePanel?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function Promo({
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
linkUrl,
|
|
26
|
+
linkTitle,
|
|
27
|
+
slug,
|
|
28
|
+
icon,
|
|
29
|
+
theme,
|
|
30
|
+
hasSidePanel,
|
|
31
|
+
}: PromoProps) {
|
|
32
|
+
const handleClick = useCallback((title, linkUrl, linkTitle, slug) => {
|
|
33
|
+
if (window && window.analytics) {
|
|
34
|
+
window.analytics.track('Nav Promo', {
|
|
35
|
+
url: linkUrl,
|
|
36
|
+
title: title,
|
|
37
|
+
callout: linkTitle,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
trackNavClickEvent(title, linkUrl, slug)
|
|
41
|
+
}
|
|
42
|
+
}, [])
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div
|
|
46
|
+
className={classNames(s.promo, {
|
|
47
|
+
[s.hasSide]: hasSidePanel,
|
|
48
|
+
[s.noSide]: !hasSidePanel,
|
|
49
|
+
})}
|
|
50
|
+
>
|
|
51
|
+
{icon && (
|
|
52
|
+
<div
|
|
53
|
+
className={classNames(s.icon, {
|
|
54
|
+
[s.hashidays]: vercelSplit(theme) === 'hashidays',
|
|
55
|
+
[s.hashiconf]: vercelSplit(theme) === 'hashiconf',
|
|
56
|
+
})}
|
|
57
|
+
>
|
|
58
|
+
<FlightIcon name={vercelSplit(icon)} />
|
|
59
|
+
</div>
|
|
60
|
+
)}
|
|
61
|
+
<div className={s.rightContent}>
|
|
62
|
+
<div>
|
|
63
|
+
<div
|
|
64
|
+
className={classNames(s.title, {
|
|
65
|
+
[s.hashidays]: vercelSplit(theme) === 'hashidays',
|
|
66
|
+
[s.hashiconf]: vercelSplit(theme) === 'hashiconf',
|
|
67
|
+
})}
|
|
68
|
+
>
|
|
69
|
+
{title}
|
|
70
|
+
</div>
|
|
71
|
+
<div className={s.description}>{description}</div>
|
|
72
|
+
</div>
|
|
73
|
+
<NavigationMenu.Link asChild>
|
|
74
|
+
<Link
|
|
75
|
+
href={parseUrl(linkUrl).href}
|
|
76
|
+
className={s.link}
|
|
77
|
+
onClickCapture={() => handleClick(title, linkUrl, linkTitle, slug)}
|
|
78
|
+
>
|
|
79
|
+
{linkTitle}
|
|
80
|
+
<FlightIcon name="external-link" />
|
|
81
|
+
</Link>
|
|
82
|
+
</NavigationMenu.Link>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
|
+
|
|
3
|
+
.promo {
|
|
4
|
+
display: flex;
|
|
5
|
+
border-radius: var(--hdsplus-spacing-01);
|
|
6
|
+
border: 1px solid var(--token-color-border-faint);
|
|
7
|
+
background-color: var(--token-color-surface-faint);
|
|
8
|
+
padding: var(--hdsplus-spacing-05) var(--hdsplus-spacing-08)
|
|
9
|
+
var(--hdsplus-spacing-06) var(--hdsplus-spacing-08);
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
gap: var(--hdsplus-spacing-04);
|
|
12
|
+
margin: var(--hdsplus-spacing-07);
|
|
13
|
+
margin-bottom: var(--hdsplus-spacing-09);
|
|
14
|
+
|
|
15
|
+
@media (--large) {
|
|
16
|
+
&.noSide {
|
|
17
|
+
margin: 0;
|
|
18
|
+
width: min-content;
|
|
19
|
+
min-width: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (--dev-dot-viewport) {
|
|
24
|
+
&.hasSide {
|
|
25
|
+
margin: 0;
|
|
26
|
+
width: min-content;
|
|
27
|
+
min-width: 100%;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.rightContent {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-wrap: wrap;
|
|
35
|
+
gap: var(--hdsplus-spacing-03);
|
|
36
|
+
width: 100%;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.title {
|
|
41
|
+
font-weight: var(--font-weight-semi-bold);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.description {
|
|
45
|
+
font-size: var(--hdsplus-typography-body-200-font-size);
|
|
46
|
+
font-weight: var(--token-typography-font-weight-regular);
|
|
47
|
+
margin-top: var(--hdsplus-spacing-01);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.icon {
|
|
51
|
+
display: none;
|
|
52
|
+
|
|
53
|
+
@media (--large) {
|
|
54
|
+
@nest .noSide & {
|
|
55
|
+
display: block;
|
|
56
|
+
margin-top: 3px;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (--dev-dot-viewport) {
|
|
61
|
+
@nest .hasSide & {
|
|
62
|
+
display: block;
|
|
63
|
+
margin-top: 3px;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.link {
|
|
69
|
+
color: var(--token-color-foreground-strong);
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: row;
|
|
72
|
+
align-items: center;
|
|
73
|
+
gap: var(--hdsplus-spacing-02);
|
|
74
|
+
|
|
75
|
+
&:hover {
|
|
76
|
+
text-decoration: underline;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:focus {
|
|
80
|
+
outline: 2px solid var(--token-color-focus-action-internal);
|
|
81
|
+
outline-style: auto;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.hashidays {
|
|
86
|
+
background: linear-gradient(
|
|
87
|
+
90deg,
|
|
88
|
+
#7b54b6 0%,
|
|
89
|
+
#4c69d8 74.77%,
|
|
90
|
+
#60d0dc 115.93%
|
|
91
|
+
);
|
|
92
|
+
-webkit-background-clip: text;
|
|
93
|
+
-webkit-text-fill-color: transparent;
|
|
94
|
+
max-width: fit-content;
|
|
95
|
+
|
|
96
|
+
& svg {
|
|
97
|
+
color: #7956b9;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.hashiconf {
|
|
102
|
+
background: linear-gradient(
|
|
103
|
+
to right,
|
|
104
|
+
var(--token-color-terraform-foreground),
|
|
105
|
+
var(--token-color-vagrant-foreground)
|
|
106
|
+
);
|
|
107
|
+
-webkit-background-clip: text;
|
|
108
|
+
-webkit-text-fill-color: transparent;
|
|
109
|
+
max-width: fit-content;
|
|
110
|
+
|
|
111
|
+
& svg {
|
|
112
|
+
color: var(--token-color-terraform-foreground);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import ProductPanel, { type NavProductProps } from './product-panel'
|
|
2
|
+
import StandardPanel, { type NavItem } from './standard-panel'
|
|
3
|
+
import { PromoProps } from './components/promo'
|
|
4
|
+
|
|
5
|
+
export { ProductPanel, StandardPanel }
|
|
6
|
+
export type { NavProductProps, PromoProps, NavItem }
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import Link from 'next/link'
|
|
3
|
+
import * as NavPanel from '../components/panel'
|
|
4
|
+
import Promo, { type PromoProps } from '../components/promo'
|
|
5
|
+
import { Products } from '@hashicorp/platform-product-meta'
|
|
6
|
+
import FlightIcon from '@hashicorp/react-design-system-components/src/components/flight-icon'
|
|
7
|
+
import { TextPlus } from '@hashicorp/react-design-system-components/src/components/text'
|
|
8
|
+
import { parseUrl } from '../../../lib/parse-url'
|
|
9
|
+
import { trackNavClickEvent } from '../../../lib/track-nav-click-event'
|
|
10
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
11
|
+
import s from './style.module.css'
|
|
12
|
+
|
|
13
|
+
const PRODUCT_LOGO_MAP = new Map([
|
|
14
|
+
['Terraform', 'terraform-fill'],
|
|
15
|
+
['Packer', 'packer-fill-color'],
|
|
16
|
+
['Vault', 'vault-fill-color'],
|
|
17
|
+
['Boundary', 'boundary-fill-color'],
|
|
18
|
+
['Consul', 'consul-fill-color'],
|
|
19
|
+
['Nomad', 'nomad-fill-color'],
|
|
20
|
+
['Waypoint', 'waypoint-fill-color'],
|
|
21
|
+
['Vagrant', 'vagrant-fill-color'],
|
|
22
|
+
['HCP Vault Secrets', 'vault-secrets'],
|
|
23
|
+
['HCP Vault Radar', 'vault-radar'],
|
|
24
|
+
])
|
|
25
|
+
|
|
26
|
+
const PRODUCT_LOGO_EXCEPTION_CLASSNAMES = {
|
|
27
|
+
Terraform: 'terraform',
|
|
28
|
+
'HCP Vault Secrets': 'hcpVaultSecrets',
|
|
29
|
+
'HCP Vault Radar': 'hcpVaultRadar',
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ProductsPanelProps {
|
|
33
|
+
productCategories: any
|
|
34
|
+
promo?: PromoProps
|
|
35
|
+
sidePanel?: {
|
|
36
|
+
label: string
|
|
37
|
+
navItems: {
|
|
38
|
+
icon: string
|
|
39
|
+
title: string
|
|
40
|
+
description: string
|
|
41
|
+
url: string
|
|
42
|
+
}[]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const ProductPanel = ({
|
|
47
|
+
productCategories,
|
|
48
|
+
promo,
|
|
49
|
+
sidePanel,
|
|
50
|
+
}: ProductsPanelProps) => {
|
|
51
|
+
return (
|
|
52
|
+
<NavPanel.Root
|
|
53
|
+
className={classNames(s.productPanel, {
|
|
54
|
+
[s.hasSide]: sidePanel,
|
|
55
|
+
[s.noSide]: !sidePanel,
|
|
56
|
+
})}
|
|
57
|
+
hasSidePanel={Boolean(sidePanel)}
|
|
58
|
+
>
|
|
59
|
+
<div className={s.mainPanel}>
|
|
60
|
+
<NavPanel.Column hasSidePanel={Boolean(sidePanel)}>
|
|
61
|
+
<ul className={s.productCategories}>
|
|
62
|
+
{productCategories.map(({ title, products }) => {
|
|
63
|
+
return (
|
|
64
|
+
<li key={title} className={s.productCategory}>
|
|
65
|
+
<TextPlus.Body className={s.eyebrow}>{title}</TextPlus.Body>
|
|
66
|
+
<ul className={s.productList}>
|
|
67
|
+
{products.map((product) => {
|
|
68
|
+
return (
|
|
69
|
+
<li key={product.url}>
|
|
70
|
+
<NavProduct {...product} />
|
|
71
|
+
</li>
|
|
72
|
+
)
|
|
73
|
+
})}
|
|
74
|
+
</ul>
|
|
75
|
+
</li>
|
|
76
|
+
)
|
|
77
|
+
})}
|
|
78
|
+
</ul>
|
|
79
|
+
</NavPanel.Column>
|
|
80
|
+
{promo ? <Promo {...promo} hasSidePanel={Boolean(sidePanel)} /> : null}
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
{sidePanel ? (
|
|
84
|
+
<NavPanel.Column className={s.sidePanel}>
|
|
85
|
+
<TextPlus.Body size="200" weight="semibold">
|
|
86
|
+
{sidePanel.label}
|
|
87
|
+
</TextPlus.Body>
|
|
88
|
+
|
|
89
|
+
{/* ! TODO Replace the below list with the <LinkList /> component,
|
|
90
|
+
That component will require a refactor to support greater customization
|
|
91
|
+
Ticket:
|
|
92
|
+
https://app.asana.com/0/1206176289707208/1208162145034615/f
|
|
93
|
+
*/}
|
|
94
|
+
<ul className={s.sidePanelItems}>
|
|
95
|
+
{sidePanel.navItems.map(({ icon, title, description, url }) => {
|
|
96
|
+
return (
|
|
97
|
+
<li key={title}>
|
|
98
|
+
<Link
|
|
99
|
+
aria-label={`${title} - ${description}`}
|
|
100
|
+
href={parseUrl(url).href}
|
|
101
|
+
className={classNames(s.sidePanelItem, s.focusIndicator)}
|
|
102
|
+
>
|
|
103
|
+
<div className={s.iconBackground}>
|
|
104
|
+
<FlightIcon
|
|
105
|
+
size={16}
|
|
106
|
+
name={icon}
|
|
107
|
+
color="var(--token-color-foreground-faint)"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
<div className={s.sidePanelItemContent}>
|
|
111
|
+
<TextPlus.Body size="200" weight="semibold" tag="span">
|
|
112
|
+
{title}
|
|
113
|
+
</TextPlus.Body>
|
|
114
|
+
<span className={s.sidePanelItemDesc}>{description}</span>
|
|
115
|
+
</div>
|
|
116
|
+
</Link>
|
|
117
|
+
</li>
|
|
118
|
+
)
|
|
119
|
+
})}
|
|
120
|
+
</ul>
|
|
121
|
+
</NavPanel.Column>
|
|
122
|
+
) : null}
|
|
123
|
+
</NavPanel.Root>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface NavProductProps {
|
|
128
|
+
url: string
|
|
129
|
+
product: Products | string
|
|
130
|
+
description: string
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function NavProduct({ url, product, description }: NavProductProps) {
|
|
134
|
+
return (
|
|
135
|
+
<NavigationMenu.Link asChild>
|
|
136
|
+
<Link
|
|
137
|
+
aria-label={`${product} - ${description}`}
|
|
138
|
+
href={parseUrl(url).href}
|
|
139
|
+
onClickCapture={() => {
|
|
140
|
+
trackNavClickEvent(product, url, 'products')
|
|
141
|
+
}}
|
|
142
|
+
className={s.focusIndicator}
|
|
143
|
+
>
|
|
144
|
+
<div className={s.productWrapper}>
|
|
145
|
+
<div className={s.productLogo}>
|
|
146
|
+
<FlightIcon
|
|
147
|
+
name={PRODUCT_LOGO_MAP.get(product) ?? 'hashicorp-fill-color'}
|
|
148
|
+
className={
|
|
149
|
+
PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]
|
|
150
|
+
? s[PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]]
|
|
151
|
+
: undefined
|
|
152
|
+
}
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
<div className={s.productTextContent}>
|
|
156
|
+
<span>{product}</span>
|
|
157
|
+
<span className={s.productDesc}>{description}</span>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
</Link>
|
|
161
|
+
</NavigationMenu.Link>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export default ProductPanel
|