@hashicorp/react-components 1.1.8 → 1.1.11
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 +4 -8
- package/src/components/nav-panel/components/flight-icon/index.tsx +51 -0
- package/src/components/nav-panel/components/flight-icon/style.module.css +3 -0
- package/src/components/nav-panel/components/link-list/index.tsx +15 -9
- package/src/components/nav-panel/components/link-list/style.module.css +10 -10
- package/src/components/nav-panel/components/panel/column/style.module.css +3 -3
- package/src/components/nav-panel/components/panel/root/style.module.css +6 -6
- package/src/components/nav-panel/components/promo/index.tsx +15 -9
- package/src/components/nav-panel/components/promo/style.module.css +27 -13
- package/src/components/nav-panel/components/text/index.tsx +34 -0
- package/src/components/nav-panel/product-panel/index.tsx +39 -14
- package/src/components/nav-panel/product-panel/style.module.css +78 -37
- package/src/components/nav-panel/standard-panel/index.tsx +3 -0
- package/src/components/nav-panel/standard-panel/style.module.css +2 -2
- package/src/lib/get-localized-link-props/index.test.ts +30 -0
- package/src/lib/get-localized-link-props/index.ts +45 -0
- package/src/lib/parse-url/index.test.ts +40 -1
- package/src/lib/parse-url/index.ts +75 -9
- package/src/lib/send-posthog-event/index.ts +22 -0
- package/src/lib/supported-locales/index.ts +1 -0
- package/src/lib/track-nav-click-event/index.ts +4 -4
- package/src/lib/v/index.ts +4 -5
- package/src/components/actions/index.tsx +0 -107
- package/src/components/actions/style.module.css +0 -28
- package/src/components/actions/types.ts +0 -73
- package/src/components/call-to-action/index.tsx +0 -205
- package/src/components/call-to-action/styles/variant-centered.module.css +0 -93
- package/src/components/call-to-action/styles/variant-compact-grid.module.css +0 -88
- package/src/components/call-to-action/styles/variant-compact.module.css +0 -91
- package/src/components/call-to-action/styles/variant-links.module.css +0 -85
- package/src/components/card/README.md +0 -11
- package/src/components/card/card.tsx +0 -45
- package/src/components/card/index.test.tsx +0 -69
- package/src/components/card/index.tsx +0 -14
- package/src/components/card/newsroom-card/index.test.tsx +0 -39
- package/src/components/card/newsroom-card/index.tsx +0 -37
- package/src/components/card/newsroom-card/style.module.css +0 -12
- package/src/components/card/partner-card/index.test.tsx +0 -57
- package/src/components/card/partner-card/index.tsx +0 -69
- package/src/components/card/partner-card/style.module.css +0 -24
- package/src/components/card/person-card/index.test.tsx +0 -71
- package/src/components/card/person-card/index.tsx +0 -93
- package/src/components/card/person-card/style.module.css +0 -33
- package/src/components/card/primitives.tsx +0 -176
- package/src/components/card/promo-card/index.tsx +0 -51
- package/src/components/card/resource-card/index.test.tsx +0 -48
- package/src/components/card/resource-card/index.tsx +0 -37
- package/src/components/card/style.module.css +0 -145
- package/src/components/card/types.ts +0 -66
- package/src/components/card/unified-card/index.tsx +0 -64
- package/src/components/consent-manager/README.md +0 -73
- package/src/components/consent-manager/components/banner/banner.module.css +0 -23
- package/src/components/consent-manager/components/banner/banner.test.tsx +0 -31
- package/src/components/consent-manager/components/banner/banner.tsx +0 -73
- package/src/components/consent-manager/components/dialog/dialog.module.css +0 -145
- package/src/components/consent-manager/components/dialog/dialog.test.tsx +0 -194
- package/src/components/consent-manager/components/dialog/dialog.tsx +0 -339
- package/src/components/consent-manager/img/icn_close.tsx +0 -19
- package/src/components/consent-manager/index.test.tsx +0 -334
- package/src/components/consent-manager/index.tsx +0 -186
- package/src/components/consent-manager/loader/README.md +0 -29
- package/src/components/consent-manager/loader/categories.ts +0 -22
- package/src/components/consent-manager/loader/index.tsx +0 -94
- package/src/components/consent-manager/loader/presets/enterprise.ts +0 -12
- package/src/components/consent-manager/loader/presets/oss.ts +0 -10
- package/src/components/consent-manager/loader/services.ts +0 -45
- package/src/components/consent-manager/scripts/custom.tsx +0 -59
- package/src/components/consent-manager/scripts/segment.tsx +0 -87
- package/src/components/consent-manager/style.module.css +0 -9
- package/src/components/consent-manager/types.ts +0 -55
- package/src/components/consent-manager/util/cookies.test.ts +0 -75
- package/src/components/consent-manager/util/cookies.ts +0 -70
- package/src/components/consent-manager/util/integrations.test.ts +0 -115
- package/src/components/consent-manager/util/integrations.ts +0 -110
- package/src/components/intro/index.tsx +0 -82
- package/src/components/intro/style.module.css +0 -67
- package/src/components/intro/types.ts +0 -44
- package/src/components/marketo-form/CHANGELOG.md +0 -122
- package/src/components/marketo-form/README.md +0 -1
- package/src/components/marketo-form/contexts/FormMetadata.ts +0 -11
- package/src/components/marketo-form/docs.mdx +0 -197
- package/src/components/marketo-form/fixtures/index.ts +0 -185
- package/src/components/marketo-form/form/index.tsx +0 -369
- package/src/components/marketo-form/index.test.tsx +0 -320
- package/src/components/marketo-form/index.ts +0 -11
- package/src/components/marketo-form/package.original.json +0 -30
- package/src/components/marketo-form/partials/error-message/index.tsx +0 -12
- package/src/components/marketo-form/partials/error-message/style.module.css +0 -13
- package/src/components/marketo-form/partials/field/index.tsx +0 -90
- package/src/components/marketo-form/partials/field-wrapper/index.tsx +0 -26
- package/src/components/marketo-form/partials/fields/checkbox-field/index.tsx +0 -32
- package/src/components/marketo-form/partials/fields/email-field/index.tsx +0 -35
- package/src/components/marketo-form/partials/fields/form-page-url-field/index.tsx +0 -21
- package/src/components/marketo-form/partials/fields/hidden-field/index.tsx +0 -37
- package/src/components/marketo-form/partials/fields/htmltext-field/index.tsx +0 -21
- package/src/components/marketo-form/partials/fields/htmltext-field/style.module.css +0 -18
- package/src/components/marketo-form/partials/fields/name-field/index.tsx +0 -19
- package/src/components/marketo-form/partials/fields/name-field/style.module.css +0 -13
- package/src/components/marketo-form/partials/fields/radio-buttons-field/index.tsx +0 -48
- package/src/components/marketo-form/partials/fields/select-field/index.tsx +0 -39
- package/src/components/marketo-form/partials/fields/select-field/style.module.css +0 -5
- package/src/components/marketo-form/partials/fields/telephone-field/index.tsx +0 -30
- package/src/components/marketo-form/partials/fields/text-field/index.tsx +0 -30
- package/src/components/marketo-form/partials/fields/textarea-field/index.tsx +0 -29
- package/src/components/marketo-form/partials/label/index.tsx +0 -24
- package/src/components/marketo-form/partials/label/style.module.css +0 -12
- package/src/components/marketo-form/partials/visibility-rule/index.tsx +0 -84
- package/src/components/marketo-form/props.js +0 -66
- package/src/components/marketo-form/server/api-routes.ts +0 -109
- package/src/components/marketo-form/server/client.ts +0 -98
- package/src/components/marketo-form/server/index.ts +0 -8
- package/src/components/marketo-form/types.ts +0 -268
- package/src/components/marketo-form/utils.test.tsx +0 -103
- package/src/components/marketo-form/utils.ts +0 -449
- package/src/components/next-steps/index.tsx +0 -137
- package/src/components/next-steps/style.module.css +0 -270
- package/src/components/next-steps/types.ts +0 -63
- package/src/components/product-badge/index.test.tsx +0 -11
- package/src/components/product-badge/index.tsx +0 -42
- package/src/components/product-badge/style.module.css +0 -76
- package/src/components/products-used/index.tsx +0 -84
- package/src/components/products-used/style.module.css +0 -87
- package/src/components/products-used/types.ts +0 -31
- package/src/components/related-content/index.test.tsx +0 -74
- package/src/components/related-content/index.tsx +0 -56
- package/src/components/related-content/style.module.css +0 -89
- package/src/components/related-content/types.ts +0 -21
- package/src/components/subnav/helpers/areBasePathsMatching.ts +0 -13
- package/src/components/subnav/helpers/traverse/index.ts +0 -42
- package/src/components/subnav/helpers/useHeightRef.ts +0 -42
- package/src/components/subnav/helpers/useNavRef.ts +0 -30
- package/src/components/subnav/helpers/useOverflowRef.ts +0 -85
- package/src/components/subnav/helpers/useStuckRef.ts +0 -51
- package/src/components/subnav/index.tsx +0 -199
- package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.test.ts +0 -26
- package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.ts +0 -22
- package/src/components/subnav/partials/CtaLinks/github-stars-link/index.tsx +0 -87
- package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.test.ts +0 -29
- package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.ts +0 -32
- package/src/components/subnav/partials/CtaLinks/github-stars-link/style.module.css +0 -85
- package/src/components/subnav/partials/CtaLinks/icons/github-logo.js +0 -20
- package/src/components/subnav/partials/CtaLinks/icons/github.svg.js +0 -7
- package/src/components/subnav/partials/CtaLinks/icons/star.js +0 -20
- package/src/components/subnav/partials/CtaLinks/index.tsx +0 -130
- package/src/components/subnav/partials/CtaLinks/style.module.css +0 -45
- package/src/components/subnav/partials/DropdownTrigger/index.tsx +0 -35
- package/src/components/subnav/partials/DropdownTrigger/style.module.css +0 -36
- package/src/components/subnav/partials/MenuItemsDefault/index.tsx +0 -151
- package/src/components/subnav/partials/MenuItemsDefault/style.module.css +0 -91
- package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +0 -139
- package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +0 -82
- package/src/components/subnav/partials/TitleLink/index.tsx +0 -113
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +0 -9
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +0 -9
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-dark.ts +0 -23
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-light.ts +0 -23
- package/src/components/subnav/partials/TitleLink/style.module.css +0 -43
- package/src/components/subnav/partials/nav-item-text/index.tsx +0 -37
- package/src/components/subnav/partials/nav-item-text/style.module.css +0 -15
- package/src/components/subnav/style.module.css +0 -68
- package/src/components/subnav/subnav-consts.ts +0 -1
- 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": "1.1.
|
|
3
|
+
"version": "1.1.11",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"lint": "next-hashicorp lint",
|
|
@@ -8,20 +8,16 @@
|
|
|
8
8
|
"test:watch": "vitest watch"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@hashicorp/flight-icons": "^3.
|
|
11
|
+
"@hashicorp/flight-icons": "^3.7.0",
|
|
12
12
|
"@hashicorp/platform-product-meta": "^0.1.1",
|
|
13
13
|
"@hashicorp/platform-util": "^0.2.0",
|
|
14
|
-
"@hashicorp/react-design-system-components": "*",
|
|
15
14
|
"@hashicorp/web-mktg-logos": "*",
|
|
16
15
|
"@radix-ui/react-navigation-menu": "^1.2.0",
|
|
17
16
|
"@radix-ui/react-visually-hidden": "^1.1.0",
|
|
18
|
-
"@vercel/analytics": "^1.3.1",
|
|
19
17
|
"@vercel/fetch": "^7.0.0",
|
|
20
18
|
"@vercel/stega": "^0.1.2",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"moize": "^6.1.3",
|
|
24
|
-
"react-hook-form": "^7.43.5"
|
|
19
|
+
"posthog-js": "^1.195.0",
|
|
20
|
+
"classnames": "^2.3.2"
|
|
25
21
|
},
|
|
26
22
|
"devDependencies": {
|
|
27
23
|
"@hashicorp/platform-cli": "^2.8.0",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import svgSprite from '@hashicorp/flight-icons/svg-sprite/svg-sprite.svg'
|
|
2
|
+
import classNames from 'classnames'
|
|
3
|
+
import { useId, type SVGProps } from 'react'
|
|
4
|
+
import s from './style.module.css'
|
|
5
|
+
|
|
6
|
+
interface Props extends SVGProps<SVGSVGElement> {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the icon you wish to use. If the value does not match an
|
|
9
|
+
* existing icon name, an error will be thrown. Search for existing icon
|
|
10
|
+
* names in the Icon library.
|
|
11
|
+
*/
|
|
12
|
+
name: string
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The `color` prop can be used to change the color. It works by setting
|
|
16
|
+
* the value of the icon SVG’s fill property.
|
|
17
|
+
*/
|
|
18
|
+
color?: string
|
|
19
|
+
|
|
20
|
+
className?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// When an SVG file is imported in Next.js, it is an object with a `src`
|
|
24
|
+
// property. However, tools like Webpack and Vite default to returning a URL.
|
|
25
|
+
// This runtime check allows the component to work in all of these cases.
|
|
26
|
+
const svgSpriteSrc =
|
|
27
|
+
typeof svgSprite === 'string' ? svgSprite : (svgSprite as { src: string }).src
|
|
28
|
+
|
|
29
|
+
export default function FlightIcon({
|
|
30
|
+
name,
|
|
31
|
+
color = 'currentColor',
|
|
32
|
+
className,
|
|
33
|
+
...rest
|
|
34
|
+
}: Props) {
|
|
35
|
+
const iconId = useId()
|
|
36
|
+
return (
|
|
37
|
+
<svg
|
|
38
|
+
className={classNames(s['flight-icon'], className)}
|
|
39
|
+
{...rest}
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
fill={color}
|
|
42
|
+
id={iconId}
|
|
43
|
+
width={16}
|
|
44
|
+
height={16}
|
|
45
|
+
viewBox="0 0 16 16"
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
>
|
|
48
|
+
<use href={`${svgSpriteSrc}#flight-${name}-16`}></use>
|
|
49
|
+
</svg>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Link from 'next/link'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import FlightIcon from '
|
|
2
|
+
import { vercelSplit } from '../../../../lib/v'
|
|
3
|
+
import { getLocalizedLinkProps } from '../../../../lib/get-localized-link-props'
|
|
4
|
+
import FlightIcon from '../flight-icon'
|
|
5
5
|
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
6
6
|
import s from './style.module.css'
|
|
7
7
|
|
|
8
8
|
export interface LinkListProps {
|
|
9
|
+
locale?: string
|
|
9
10
|
links: {
|
|
10
11
|
title: string
|
|
11
12
|
url: string
|
|
@@ -37,15 +38,20 @@ const GRADIENT_VALUE_MAP = new Map([
|
|
|
37
38
|
],
|
|
38
39
|
])
|
|
39
40
|
|
|
40
|
-
export default function LinkList({
|
|
41
|
+
export default function LinkList({
|
|
42
|
+
locale,
|
|
43
|
+
links,
|
|
44
|
+
linkClickHandler,
|
|
45
|
+
}: LinkListProps) {
|
|
41
46
|
return (
|
|
42
47
|
<ul className={s.linkList}>
|
|
43
48
|
{links.map((link) => {
|
|
44
49
|
let style
|
|
45
50
|
link.iconGradient
|
|
46
51
|
? (style = {
|
|
47
|
-
'--iconGradient': GRADIENT_VALUE_MAP.get(
|
|
48
|
-
|
|
52
|
+
'--iconGradient': GRADIENT_VALUE_MAP.get(
|
|
53
|
+
vercelSplit(link.iconGradient)
|
|
54
|
+
)?.iconGradient,
|
|
49
55
|
} as React.CSSProperties)
|
|
50
56
|
: (style = null)
|
|
51
57
|
return (
|
|
@@ -53,19 +59,19 @@ export default function LinkList({ links, linkClickHandler }: LinkListProps) {
|
|
|
53
59
|
<NavigationMenu.Link asChild>
|
|
54
60
|
<Link
|
|
55
61
|
className={s.link}
|
|
56
|
-
|
|
62
|
+
{...getLocalizedLinkProps(link.url, locale)}
|
|
57
63
|
onClickCapture={() => {
|
|
58
64
|
linkClickHandler && linkClickHandler(link.title, link.url)
|
|
59
65
|
}}
|
|
60
66
|
>
|
|
61
67
|
{link.iconGradient && link.icon ? (
|
|
62
68
|
<div className={s.iconBackground} style={style}>
|
|
63
|
-
<FlightIcon name={
|
|
69
|
+
<FlightIcon name={vercelSplit(link.icon)} />
|
|
64
70
|
</div>
|
|
65
71
|
) : (
|
|
66
72
|
link.icon && (
|
|
67
73
|
<FlightIcon
|
|
68
|
-
name={
|
|
74
|
+
name={vercelSplit(link.icon)}
|
|
69
75
|
color="var(--token-color-foreground-faint)"
|
|
70
76
|
/>
|
|
71
77
|
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
display: flex;
|
|
3
3
|
list-style: none;
|
|
4
4
|
flex-direction: column;
|
|
5
|
-
gap: var(--
|
|
5
|
+
gap: var(--mds-spacing-03);
|
|
6
6
|
margin: 0;
|
|
7
7
|
padding: 0;
|
|
8
8
|
}
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
.link {
|
|
11
11
|
color: var(--token-color-foreground-primary);
|
|
12
12
|
display: flex;
|
|
13
|
-
gap: var(--
|
|
14
|
-
padding: var(--
|
|
13
|
+
gap: var(--mds-spacing-04);
|
|
14
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-04);
|
|
15
15
|
min-width: 190px;
|
|
16
16
|
align-items: center;
|
|
17
17
|
|
|
18
18
|
&:hover {
|
|
19
19
|
background-color: var(--token-color-surface-interactive-hover);
|
|
20
|
-
border-radius: var(--
|
|
20
|
+
border-radius: var(--mds-spacing-01);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
&:has(.iconBackground) {
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.description {
|
|
38
|
-
font-size: var(--
|
|
39
|
-
font-weight: var(--
|
|
40
|
-
margin-top: var(--
|
|
38
|
+
font-size: var(--mds-typography-body-200-font-size);
|
|
39
|
+
font-weight: var(--mds-typography-font-weight-regular);
|
|
40
|
+
margin-top: var(--mds-spacing-02);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.iconBackground {
|
|
44
44
|
background: var(--iconGradient);
|
|
45
|
-
height: var(--
|
|
46
|
-
width: var(--
|
|
45
|
+
height: var(--mds-spacing-08);
|
|
46
|
+
width: var(--mds-spacing-08);
|
|
47
47
|
display: flex;
|
|
48
48
|
align-items: center;
|
|
49
49
|
justify-content: center;
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.boldTitle {
|
|
56
|
-
font-weight: var(--font-weight-
|
|
56
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
57
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@custom-media --dev-dot-viewport (min-width:
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
2
|
|
|
3
3
|
.column {
|
|
4
4
|
position: relative;
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
justify-content: flex-start;
|
|
8
8
|
min-width: 190px;
|
|
9
9
|
padding: 0;
|
|
10
|
-
margin: 0 var(--
|
|
11
|
-
border-radius: var(--
|
|
10
|
+
margin: 0 var(--mds-spacing-07);
|
|
11
|
+
border-radius: var(--mds-spacing-03);
|
|
12
12
|
|
|
13
13
|
@media (--large) {
|
|
14
14
|
&:not(.hasSide) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@custom-media --dev-dot-viewport (min-width:
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
2
|
|
|
3
3
|
.root {
|
|
4
4
|
width: 100%;
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
flex-direction: column;
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
/* stylelint-disable-next-line unit-no-unknown */
|
|
9
|
-
min-height: calc(100dvh - var(--
|
|
9
|
+
min-height: calc(100dvh - var(--mds-spacing-12));
|
|
10
10
|
|
|
11
11
|
@media (--large) {
|
|
12
12
|
&:not(.hasSide) {
|
|
13
13
|
justify-content: flex-start;
|
|
14
14
|
height: 100%;
|
|
15
15
|
min-height: fit-content;
|
|
16
|
-
padding: var(--
|
|
17
|
-
gap: var(--
|
|
16
|
+
padding: var(--mds-spacing-05) var(--mds-spacing-04);
|
|
17
|
+
gap: var(--mds-spacing-04);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
justify-content: flex-start;
|
|
24
24
|
height: 100%;
|
|
25
25
|
min-height: fit-content;
|
|
26
|
-
padding: var(--
|
|
27
|
-
gap: var(--
|
|
26
|
+
padding: var(--mds-spacing-05) var(--mds-spacing-04);
|
|
27
|
+
gap: var(--mds-spacing-04);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { useCallback } from 'react'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
|
-
import {
|
|
3
|
+
import { vercelSplit } from '../../../../lib/v'
|
|
4
4
|
import Link from 'next/link'
|
|
5
|
-
import {
|
|
5
|
+
import { getLocalizedLinkProps } from '../../../../lib/get-localized-link-props'
|
|
6
6
|
import { trackNavClickEvent } from '../../../../lib/track-nav-click-event'
|
|
7
|
-
import FlightIcon from '
|
|
7
|
+
import FlightIcon from '../flight-icon'
|
|
8
8
|
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
9
9
|
import s from './style.module.css'
|
|
10
10
|
|
|
11
11
|
export interface PromoProps {
|
|
12
|
+
locale?: string
|
|
12
13
|
title: string
|
|
13
14
|
description: string
|
|
14
15
|
linkUrl: string
|
|
@@ -17,9 +18,11 @@ export interface PromoProps {
|
|
|
17
18
|
icon?: string
|
|
18
19
|
theme: string
|
|
19
20
|
hasSidePanel?: boolean
|
|
21
|
+
isPromoOnTop?: boolean
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export default function Promo({
|
|
25
|
+
locale,
|
|
23
26
|
title,
|
|
24
27
|
description,
|
|
25
28
|
linkUrl,
|
|
@@ -28,6 +31,7 @@ export default function Promo({
|
|
|
28
31
|
icon,
|
|
29
32
|
theme,
|
|
30
33
|
hasSidePanel,
|
|
34
|
+
isPromoOnTop = false,
|
|
31
35
|
}: PromoProps) {
|
|
32
36
|
const handleClick = useCallback((title, linkUrl, linkTitle, slug) => {
|
|
33
37
|
if (window && window.analytics) {
|
|
@@ -46,24 +50,25 @@ export default function Promo({
|
|
|
46
50
|
className={classNames(s.promo, {
|
|
47
51
|
[s.hasSide]: hasSidePanel,
|
|
48
52
|
[s.noSide]: !hasSidePanel,
|
|
53
|
+
[s.topPromo]: isPromoOnTop,
|
|
49
54
|
})}
|
|
50
55
|
>
|
|
51
56
|
{icon && (
|
|
52
57
|
<div
|
|
53
58
|
className={classNames(s.icon, {
|
|
54
|
-
[s.hashidays]:
|
|
55
|
-
[s.hashiconf]:
|
|
59
|
+
[s.hashidays]: vercelSplit(theme) === 'hashidays',
|
|
60
|
+
[s.hashiconf]: vercelSplit(theme) === 'hashiconf',
|
|
56
61
|
})}
|
|
57
62
|
>
|
|
58
|
-
<FlightIcon name={
|
|
63
|
+
<FlightIcon name={vercelSplit(icon)} />
|
|
59
64
|
</div>
|
|
60
65
|
)}
|
|
61
66
|
<div className={s.rightContent}>
|
|
62
67
|
<div>
|
|
63
68
|
<div
|
|
64
69
|
className={classNames(s.title, {
|
|
65
|
-
[s.hashidays]:
|
|
66
|
-
[s.hashiconf]:
|
|
70
|
+
[s.hashidays]: vercelSplit(theme) === 'hashidays',
|
|
71
|
+
[s.hashiconf]: vercelSplit(theme) === 'hashiconf',
|
|
67
72
|
})}
|
|
68
73
|
>
|
|
69
74
|
{title}
|
|
@@ -72,7 +77,8 @@ export default function Promo({
|
|
|
72
77
|
</div>
|
|
73
78
|
<NavigationMenu.Link asChild>
|
|
74
79
|
<Link
|
|
75
|
-
|
|
80
|
+
locale={locale ? locale : undefined}
|
|
81
|
+
{...getLocalizedLinkProps(linkUrl, locale)}
|
|
76
82
|
className={s.link}
|
|
77
83
|
onClickCapture={() => handleClick(title, linkUrl, linkTitle, slug)}
|
|
78
84
|
>
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
@custom-media --dev-dot-viewport (min-width:
|
|
1
|
+
@custom-media --dev-dot-viewport (min-width: 924px);
|
|
2
2
|
|
|
3
3
|
.promo {
|
|
4
4
|
display: flex;
|
|
5
|
-
border-radius: var(--
|
|
5
|
+
border-radius: var(--mds-spacing-01);
|
|
6
6
|
border: 1px solid var(--token-color-border-faint);
|
|
7
7
|
background-color: var(--token-color-surface-faint);
|
|
8
|
-
padding: var(--
|
|
9
|
-
var(--
|
|
8
|
+
padding: var(--mds-spacing-05) var(--mds-spacing-08) var(--mds-spacing-06)
|
|
9
|
+
var(--mds-spacing-08);
|
|
10
10
|
flex-direction: row;
|
|
11
|
-
gap: var(--
|
|
12
|
-
margin: var(--
|
|
13
|
-
margin-bottom: var(--
|
|
11
|
+
gap: var(--mds-spacing-04);
|
|
12
|
+
margin: var(--mds-spacing-07);
|
|
13
|
+
margin-bottom: var(--mds-spacing-09);
|
|
14
14
|
|
|
15
15
|
@media (--large) {
|
|
16
|
+
&.topPromo {
|
|
17
|
+
margin-bottom: var(--mds-spacing-05);
|
|
18
|
+
}
|
|
16
19
|
&.noSide {
|
|
17
20
|
margin: 0;
|
|
18
21
|
width: min-content;
|
|
@@ -21,7 +24,14 @@
|
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
@media (--dev-dot-viewport) {
|
|
27
|
+
&.topPromo {
|
|
28
|
+
margin-bottom: var(--mds-spacing-05);
|
|
29
|
+
}
|
|
24
30
|
&.hasSide {
|
|
31
|
+
&.topPromo {
|
|
32
|
+
margin-bottom: var(--mds-spacing-05);
|
|
33
|
+
}
|
|
34
|
+
|
|
25
35
|
margin: 0;
|
|
26
36
|
width: min-content;
|
|
27
37
|
min-width: 100%;
|
|
@@ -29,22 +39,26 @@
|
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
41
|
|
|
42
|
+
.topPromo {
|
|
43
|
+
margin-bottom: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
32
46
|
.rightContent {
|
|
33
47
|
display: flex;
|
|
34
48
|
flex-wrap: wrap;
|
|
35
|
-
gap: var(--
|
|
49
|
+
gap: var(--mds-spacing-03);
|
|
36
50
|
width: 100%;
|
|
37
51
|
justify-content: space-between;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
.title {
|
|
41
|
-
font-weight: var(--font-weight-
|
|
55
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
42
56
|
}
|
|
43
57
|
|
|
44
58
|
.description {
|
|
45
|
-
font-size: var(--
|
|
46
|
-
font-weight: var(--
|
|
47
|
-
margin-top: var(--
|
|
59
|
+
font-size: var(--mds-typography-body-200-font-size);
|
|
60
|
+
font-weight: var(--mds-typography-font-weight-regular);
|
|
61
|
+
margin-top: var(--mds-spacing-01);
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
.icon {
|
|
@@ -70,7 +84,7 @@
|
|
|
70
84
|
display: flex;
|
|
71
85
|
flex-direction: row;
|
|
72
86
|
align-items: center;
|
|
73
|
-
gap: var(--
|
|
87
|
+
gap: var(--mds-spacing-02);
|
|
74
88
|
|
|
75
89
|
&:hover {
|
|
76
90
|
text-decoration: underline;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import { type ReactNode, type HTMLAttributes } from 'react'
|
|
3
|
+
|
|
4
|
+
type TextSize = '200' | '300' | '400'
|
|
5
|
+
type TextWeight = 'regular' | 'medium' | 'semibold' | 'bold'
|
|
6
|
+
|
|
7
|
+
interface TextProps extends HTMLAttributes<HTMLSpanElement> {
|
|
8
|
+
size?: TextSize
|
|
9
|
+
weight?: TextWeight
|
|
10
|
+
children: ReactNode
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Text = ({
|
|
14
|
+
size = '300',
|
|
15
|
+
weight,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
...rest
|
|
19
|
+
}: TextProps) => {
|
|
20
|
+
return (
|
|
21
|
+
<span
|
|
22
|
+
className={classNames(
|
|
23
|
+
`mds-typography-body-${size}`,
|
|
24
|
+
weight && `mds-typography-font-weight-${weight}`,
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...rest}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</span>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Text }
|
|
@@ -2,10 +2,10 @@ import classNames from 'classnames'
|
|
|
2
2
|
import Link from 'next/link'
|
|
3
3
|
import * as NavPanel from '../components/panel'
|
|
4
4
|
import Promo, { type PromoProps } from '../components/promo'
|
|
5
|
+
import { getLocalizedLinkProps } from '../../../lib/get-localized-link-props'
|
|
5
6
|
import { Products } from '@hashicorp/platform-product-meta'
|
|
6
|
-
import FlightIcon from '
|
|
7
|
-
import {
|
|
8
|
-
import { parseUrl } from '../../../lib/parse-url'
|
|
7
|
+
import FlightIcon from '../components/flight-icon'
|
|
8
|
+
import { Text } from '../components/text'
|
|
9
9
|
import { trackNavClickEvent } from '../../../lib/track-nav-click-event'
|
|
10
10
|
import * as NavigationMenu from '@radix-ui/react-navigation-menu'
|
|
11
11
|
import s from './style.module.css'
|
|
@@ -30,6 +30,7 @@ const PRODUCT_LOGO_EXCEPTION_CLASSNAMES = {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export interface ProductsPanelProps {
|
|
33
|
+
locale?: string
|
|
33
34
|
productCategories: any
|
|
34
35
|
promo?: PromoProps
|
|
35
36
|
sidePanel?: {
|
|
@@ -41,33 +42,44 @@ export interface ProductsPanelProps {
|
|
|
41
42
|
url: string
|
|
42
43
|
}[]
|
|
43
44
|
}
|
|
45
|
+
isPromoOnTop?: boolean
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
const ProductPanel = ({
|
|
49
|
+
locale,
|
|
47
50
|
productCategories,
|
|
48
51
|
promo,
|
|
49
52
|
sidePanel,
|
|
53
|
+
isPromoOnTop = false,
|
|
50
54
|
}: ProductsPanelProps) => {
|
|
51
55
|
return (
|
|
52
56
|
<NavPanel.Root
|
|
53
57
|
className={classNames(s.productPanel, {
|
|
54
58
|
[s.hasSide]: sidePanel,
|
|
55
59
|
[s.noSide]: !sidePanel,
|
|
60
|
+
[s.topPromo]: isPromoOnTop,
|
|
56
61
|
})}
|
|
57
62
|
hasSidePanel={Boolean(sidePanel)}
|
|
58
63
|
>
|
|
59
64
|
<div className={s.mainPanel}>
|
|
65
|
+
{promo && isPromoOnTop ? (
|
|
66
|
+
<Promo
|
|
67
|
+
{...promo}
|
|
68
|
+
hasSidePanel={Boolean(sidePanel)}
|
|
69
|
+
isPromoOnTop={isPromoOnTop}
|
|
70
|
+
/>
|
|
71
|
+
) : null}
|
|
60
72
|
<NavPanel.Column hasSidePanel={Boolean(sidePanel)}>
|
|
61
73
|
<ul className={s.productCategories}>
|
|
62
74
|
{productCategories.map(({ title, products }) => {
|
|
63
75
|
return (
|
|
64
76
|
<li key={title} className={s.productCategory}>
|
|
65
|
-
<
|
|
77
|
+
<Text className={s.eyebrow}>{title}</Text>
|
|
66
78
|
<ul className={s.productList}>
|
|
67
79
|
{products.map((product) => {
|
|
68
80
|
return (
|
|
69
81
|
<li key={product.url}>
|
|
70
|
-
<NavProduct {...product} />
|
|
82
|
+
<NavProduct locale={locale} {...product} />
|
|
71
83
|
</li>
|
|
72
84
|
)
|
|
73
85
|
})}
|
|
@@ -77,14 +89,16 @@ const ProductPanel = ({
|
|
|
77
89
|
})}
|
|
78
90
|
</ul>
|
|
79
91
|
</NavPanel.Column>
|
|
80
|
-
{promo
|
|
92
|
+
{promo && !isPromoOnTop ? (
|
|
93
|
+
<Promo {...promo} hasSidePanel={Boolean(sidePanel)} />
|
|
94
|
+
) : null}
|
|
81
95
|
</div>
|
|
82
96
|
|
|
83
97
|
{sidePanel ? (
|
|
84
98
|
<NavPanel.Column className={s.sidePanel}>
|
|
85
|
-
<
|
|
99
|
+
<Text size="200" weight="semibold" className={s.sidePanelText}>
|
|
86
100
|
{sidePanel.label}
|
|
87
|
-
</
|
|
101
|
+
</Text>
|
|
88
102
|
|
|
89
103
|
{/* ! TODO Replace the below list with the <LinkList /> component,
|
|
90
104
|
That component will require a refactor to support greater customization
|
|
@@ -95,18 +109,26 @@ const ProductPanel = ({
|
|
|
95
109
|
{sidePanel.navItems.map(({ icon, title, description, url }) => {
|
|
96
110
|
return (
|
|
97
111
|
<li key={title}>
|
|
98
|
-
<Link
|
|
112
|
+
<Link
|
|
113
|
+
aria-label={`${title} - ${description}`}
|
|
114
|
+
{...getLocalizedLinkProps(url, locale)}
|
|
115
|
+
locale={locale ? locale : undefined}
|
|
116
|
+
className={classNames(s.sidePanelItem, s.focusIndicator)}
|
|
117
|
+
>
|
|
99
118
|
<div className={s.iconBackground}>
|
|
100
119
|
<FlightIcon
|
|
101
|
-
size={16}
|
|
102
120
|
name={icon}
|
|
103
121
|
color="var(--token-color-foreground-faint)"
|
|
104
122
|
/>
|
|
105
123
|
</div>
|
|
106
124
|
<div className={s.sidePanelItemContent}>
|
|
107
|
-
<
|
|
125
|
+
<Text
|
|
126
|
+
size="200"
|
|
127
|
+
weight="semibold"
|
|
128
|
+
className={s.sidePanelText}
|
|
129
|
+
>
|
|
108
130
|
{title}
|
|
109
|
-
</
|
|
131
|
+
</Text>
|
|
110
132
|
<span className={s.sidePanelItemDesc}>{description}</span>
|
|
111
133
|
</div>
|
|
112
134
|
</Link>
|
|
@@ -121,16 +143,19 @@ const ProductPanel = ({
|
|
|
121
143
|
}
|
|
122
144
|
|
|
123
145
|
export interface NavProductProps {
|
|
146
|
+
locale?: string
|
|
124
147
|
url: string
|
|
125
148
|
product: Products | string
|
|
126
149
|
description: string
|
|
127
150
|
}
|
|
128
151
|
|
|
129
|
-
function NavProduct({ url, product, description }: NavProductProps) {
|
|
152
|
+
function NavProduct({ locale, url, product, description }: NavProductProps) {
|
|
130
153
|
return (
|
|
131
154
|
<NavigationMenu.Link asChild>
|
|
132
155
|
<Link
|
|
133
|
-
|
|
156
|
+
aria-label={`${product} - ${description}`}
|
|
157
|
+
{...getLocalizedLinkProps(url, locale)}
|
|
158
|
+
locale={locale ? locale : undefined}
|
|
134
159
|
onClickCapture={() => {
|
|
135
160
|
trackNavClickEvent(product, url, 'products')
|
|
136
161
|
}}
|