@hashicorp/react-components 0.0.0-nightly.91abcef → 0.0.0-nightly.928c674
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/.eslintrc.js +1 -2
- package/.stylelintrc.js +1 -1
- package/README.md +1 -1
- package/package.json +3 -8
- package/postcss.config.js +1 -1
- 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/index.tsx +127 -0
- package/src/components/nav-panel/components/link/style.module.css +64 -0
- package/src/components/nav-panel/components/link-list/index.tsx +7 -64
- package/src/components/nav-panel/components/link-list/style.module.css +1 -50
- package/src/components/nav-panel/components/panel/column/style.module.css +2 -2
- package/src/components/nav-panel/components/panel/root/style.module.css +5 -5
- package/src/components/nav-panel/components/promo/index.tsx +26 -9
- package/src/components/nav-panel/components/promo/style.module.css +33 -19
- package/src/components/nav-panel/components/text/index.tsx +34 -0
- package/src/components/nav-panel/product-panel/index.tsx +46 -14
- package/src/components/nav-panel/product-panel/style.module.css +133 -53
- package/src/components/nav-panel/standard-panel/style.module.css +2 -2
- package/src/lib/get-localized-link-props/index.ts +2 -3
- package/src/lib/parse-url/index.ts +2 -9
- package/src/lib/send-posthog-event/index.ts +22 -0
- package/src/lib/supported-locales/index.ts +10 -1
- package/src/lib/track-nav-click-event/index.ts +4 -4
- 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 -177
- 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 -40
- package/src/components/card/style.module.css +0 -145
- package/src/components/card/types.ts +0 -66
- package/src/components/card/unified-card/index.spec.tsx +0 -40
- package/src/components/card/unified-card/index.tsx +0 -58
- 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 -13
- 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 -371
- 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 -32
- package/src/components/marketo-form/partials/fields/hidden-field/index.tsx +0 -38
- 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 -262
- 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 -138
- 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 -209
- 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 -81
- 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 -131
- 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 -39
- package/src/components/subnav/partials/MenuItemsDefault/index.tsx +0 -173
- package/src/components/subnav/partials/MenuItemsDefault/style.module.css +0 -104
- package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +0 -155
- package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +0 -88
- package/src/components/subnav/partials/TitleLink/index.tsx +0 -115
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +0 -10
- package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +0 -10
- 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 -13
- package/src/components/subnav/style.module.css +0 -66
- package/src/components/subnav/subnav-consts.ts +0 -1
|
@@ -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 }
|
|
@@ -4,10 +4,12 @@ import * as NavPanel from '../components/panel'
|
|
|
4
4
|
import Promo, { type PromoProps } from '../components/promo'
|
|
5
5
|
import { getLocalizedLinkProps } from '../../../lib/get-localized-link-props'
|
|
6
6
|
import { Products } from '@hashicorp/platform-product-meta'
|
|
7
|
-
import FlightIcon from '
|
|
8
|
-
import {
|
|
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
|
+
import { LinkListProps } from '../components/link-list'
|
|
12
|
+
import NavLink from '../components/link'
|
|
11
13
|
import s from './style.module.css'
|
|
12
14
|
|
|
13
15
|
const PRODUCT_LOGO_MAP = new Map([
|
|
@@ -29,9 +31,15 @@ const PRODUCT_LOGO_EXCEPTION_CLASSNAMES = {
|
|
|
29
31
|
'HCP Vault Radar': 'hcpVaultRadar',
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
export type ProductCategoriesProps = Array<{
|
|
35
|
+
title: string
|
|
36
|
+
group?: LinkListProps['links'][0]
|
|
37
|
+
products: NavProductProps[]
|
|
38
|
+
}>
|
|
39
|
+
|
|
32
40
|
export interface ProductsPanelProps {
|
|
33
|
-
locale
|
|
34
|
-
productCategories:
|
|
41
|
+
locale?: string
|
|
42
|
+
productCategories: ProductCategoriesProps
|
|
35
43
|
promo?: PromoProps
|
|
36
44
|
sidePanel?: {
|
|
37
45
|
label: string
|
|
@@ -42,6 +50,7 @@ export interface ProductsPanelProps {
|
|
|
42
50
|
url: string
|
|
43
51
|
}[]
|
|
44
52
|
}
|
|
53
|
+
isPromoOnTop?: boolean
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
const ProductPanel = ({
|
|
@@ -49,22 +58,40 @@ const ProductPanel = ({
|
|
|
49
58
|
productCategories,
|
|
50
59
|
promo,
|
|
51
60
|
sidePanel,
|
|
61
|
+
isPromoOnTop = false,
|
|
52
62
|
}: ProductsPanelProps) => {
|
|
53
63
|
return (
|
|
54
64
|
<NavPanel.Root
|
|
55
65
|
className={classNames(s.productPanel, {
|
|
56
66
|
[s.hasSide]: sidePanel,
|
|
57
67
|
[s.noSide]: !sidePanel,
|
|
68
|
+
[s.topPromo]: isPromoOnTop,
|
|
58
69
|
})}
|
|
59
70
|
hasSidePanel={Boolean(sidePanel)}
|
|
60
71
|
>
|
|
61
72
|
<div className={s.mainPanel}>
|
|
73
|
+
{promo && isPromoOnTop ? (
|
|
74
|
+
<Promo
|
|
75
|
+
{...promo}
|
|
76
|
+
hasSidePanel={Boolean(sidePanel)}
|
|
77
|
+
isPromoOnTop={isPromoOnTop}
|
|
78
|
+
/>
|
|
79
|
+
) : null}
|
|
62
80
|
<NavPanel.Column hasSidePanel={Boolean(sidePanel)}>
|
|
63
81
|
<ul className={s.productCategories}>
|
|
64
|
-
{productCategories.map(({ title, products }) => {
|
|
82
|
+
{productCategories.map(({ group, title, products }) => {
|
|
65
83
|
return (
|
|
66
|
-
<li
|
|
67
|
-
|
|
84
|
+
<li
|
|
85
|
+
key={title}
|
|
86
|
+
className={classNames(s.productCategory, {
|
|
87
|
+
[s.productCategoryHasGroup]: group,
|
|
88
|
+
})}
|
|
89
|
+
>
|
|
90
|
+
{group ? (
|
|
91
|
+
<NavLink {...group} className={s.productGroupLink} />
|
|
92
|
+
) : (
|
|
93
|
+
<Text className={s.eyebrow}>{title}</Text>
|
|
94
|
+
)}
|
|
68
95
|
<ul className={s.productList}>
|
|
69
96
|
{products.map((product) => {
|
|
70
97
|
return (
|
|
@@ -79,14 +106,16 @@ const ProductPanel = ({
|
|
|
79
106
|
})}
|
|
80
107
|
</ul>
|
|
81
108
|
</NavPanel.Column>
|
|
82
|
-
{promo
|
|
109
|
+
{promo && !isPromoOnTop ? (
|
|
110
|
+
<Promo {...promo} hasSidePanel={Boolean(sidePanel)} />
|
|
111
|
+
) : null}
|
|
83
112
|
</div>
|
|
84
113
|
|
|
85
114
|
{sidePanel ? (
|
|
86
115
|
<NavPanel.Column className={s.sidePanel}>
|
|
87
|
-
<
|
|
116
|
+
<Text size="200" weight="semibold" className={s.sidePanelText}>
|
|
88
117
|
{sidePanel.label}
|
|
89
|
-
</
|
|
118
|
+
</Text>
|
|
90
119
|
|
|
91
120
|
{/* ! TODO Replace the below list with the <LinkList /> component,
|
|
92
121
|
That component will require a refactor to support greater customization
|
|
@@ -105,15 +134,18 @@ const ProductPanel = ({
|
|
|
105
134
|
>
|
|
106
135
|
<div className={s.iconBackground}>
|
|
107
136
|
<FlightIcon
|
|
108
|
-
size={16}
|
|
109
137
|
name={icon}
|
|
110
|
-
color="var(--
|
|
138
|
+
color="var(--mds-color-foreground-faint)"
|
|
111
139
|
/>
|
|
112
140
|
</div>
|
|
113
141
|
<div className={s.sidePanelItemContent}>
|
|
114
|
-
<
|
|
142
|
+
<Text
|
|
143
|
+
size="200"
|
|
144
|
+
weight="semibold"
|
|
145
|
+
className={s.sidePanelText}
|
|
146
|
+
>
|
|
115
147
|
{title}
|
|
116
|
-
</
|
|
148
|
+
</Text>
|
|
117
149
|
<span className={s.sidePanelItemDesc}>{description}</span>
|
|
118
150
|
</div>
|
|
119
151
|
</Link>
|
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
.productPanel {
|
|
4
4
|
height: 100%;
|
|
5
5
|
|
|
6
|
+
/* Temporarily included for devdot compatability
|
|
7
|
+
https://app.asana.com/1/90955849329269/project/1209320521286316/task/1210514680913728?focus=true */
|
|
8
|
+
--mds-spacing-01: 0.25rem;
|
|
9
|
+
--mds-spacing-02: 0.375rem;
|
|
10
|
+
--mds-spacing-03: 0.5rem;
|
|
11
|
+
--mds-spacing-04: 0.75rem;
|
|
12
|
+
--mds-spacing-05: 1rem;
|
|
13
|
+
--mds-spacing-06: 1.25rem;
|
|
14
|
+
--mds-spacing-07: 1.5rem;
|
|
15
|
+
--mds-spacing-08: 2rem;
|
|
16
|
+
--mds-spacing-09: 2.5rem;
|
|
17
|
+
--mds-spacing-10: 3rem;
|
|
18
|
+
--mds-spacing-11: 3.5rem;
|
|
19
|
+
--mds-spacing-12: 4rem;
|
|
20
|
+
--mds-spacing-13: 4.5rem;
|
|
21
|
+
--mds-spacing-14: 5.5rem;
|
|
22
|
+
--mds-spacing-15: 6rem;
|
|
23
|
+
--mds-spacing-16: 8rem;
|
|
24
|
+
--mds-spacing-17: 8.5rem;
|
|
25
|
+
--mds-typography-body-200-font-size: 0.875rem;
|
|
26
|
+
--mds-typography-font-weight-regular: 400;
|
|
27
|
+
--mds-typography-font-weight-semibold: 600;
|
|
28
|
+
|
|
6
29
|
@media (--large) {
|
|
7
30
|
&.noSide {
|
|
8
31
|
display: grid;
|
|
@@ -26,7 +49,11 @@
|
|
|
26
49
|
list-style: none;
|
|
27
50
|
padding: 0;
|
|
28
51
|
display: grid;
|
|
29
|
-
margin: var(--
|
|
52
|
+
margin: var(--mds-spacing-07) 0 0;
|
|
53
|
+
|
|
54
|
+
@nest .topPromo & {
|
|
55
|
+
margin-bottom: var(--mds-spacing-07);
|
|
56
|
+
}
|
|
30
57
|
|
|
31
58
|
@media (--large) {
|
|
32
59
|
@nest .noSide & {
|
|
@@ -47,28 +74,28 @@
|
|
|
47
74
|
min-width: 160px;
|
|
48
75
|
|
|
49
76
|
&:first-child {
|
|
50
|
-
border-bottom: 1px solid var(--
|
|
51
|
-
margin-bottom: var(--
|
|
52
|
-
padding-bottom: var(--
|
|
77
|
+
border-bottom: 1px solid var(--mds-color-border-primary);
|
|
78
|
+
margin-bottom: var(--mds-spacing-05);
|
|
79
|
+
padding-bottom: var(--mds-spacing-05);
|
|
53
80
|
}
|
|
54
81
|
}
|
|
55
82
|
|
|
56
83
|
.eyebrow {
|
|
57
|
-
padding-bottom: var(--
|
|
58
|
-
color: var(--
|
|
59
|
-
font-weight: var(--font-weight-
|
|
84
|
+
padding-bottom: var(--mds-spacing-04);
|
|
85
|
+
color: var(--mds-color-foreground-strong);
|
|
86
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
60
87
|
|
|
61
88
|
@media (--large) {
|
|
62
89
|
@nest .noSide & {
|
|
63
90
|
padding-bottom: 0;
|
|
64
|
-
padding-left: var(--
|
|
91
|
+
padding-left: var(--mds-spacing-06);
|
|
65
92
|
}
|
|
66
93
|
}
|
|
67
94
|
|
|
68
95
|
@media (--dev-dot-viewport) {
|
|
69
96
|
@nest .hasSide & {
|
|
70
97
|
padding-bottom: 0;
|
|
71
|
-
padding-left: var(--
|
|
98
|
+
padding-left: var(--mds-spacing-06);
|
|
72
99
|
}
|
|
73
100
|
}
|
|
74
101
|
}
|
|
@@ -82,8 +109,7 @@
|
|
|
82
109
|
|
|
83
110
|
@media (--large) {
|
|
84
111
|
@nest .noSide & {
|
|
85
|
-
padding: var(--
|
|
86
|
-
var(--hdsplus-spacing-04);
|
|
112
|
+
padding: var(--mds-spacing-06) var(--mds-spacing-05) var(--mds-spacing-04);
|
|
87
113
|
grid-auto-flow: row;
|
|
88
114
|
grid-template-columns: repeat(2, 300px);
|
|
89
115
|
grid-template-rows: repeat(2, max-content);
|
|
@@ -93,8 +119,7 @@
|
|
|
93
119
|
|
|
94
120
|
@media (--dev-dot-viewport) {
|
|
95
121
|
@nest .hasSide & {
|
|
96
|
-
padding: var(--
|
|
97
|
-
var(--hdsplus-spacing-04);
|
|
122
|
+
padding: var(--mds-spacing-06) var(--mds-spacing-05) var(--mds-spacing-04);
|
|
98
123
|
grid-auto-flow: row;
|
|
99
124
|
grid-template-columns: repeat(2, 300px);
|
|
100
125
|
grid-template-rows: repeat(2, max-content);
|
|
@@ -113,29 +138,29 @@
|
|
|
113
138
|
|
|
114
139
|
.productWrapper {
|
|
115
140
|
display: flex;
|
|
116
|
-
margin-bottom: var(--
|
|
117
|
-
gap: var(--
|
|
141
|
+
margin-bottom: var(--mds-spacing-05);
|
|
142
|
+
gap: var(--mds-spacing-05);
|
|
118
143
|
|
|
119
144
|
@media (--large) {
|
|
120
145
|
@nest .noSide & {
|
|
121
|
-
padding: var(--
|
|
146
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-05);
|
|
122
147
|
margin-bottom: 0;
|
|
123
148
|
|
|
124
149
|
&:hover {
|
|
125
|
-
background-color: var(--
|
|
126
|
-
border-radius: var(--
|
|
150
|
+
background-color: var(--mds-color-surface-interactive-hover);
|
|
151
|
+
border-radius: var(--mds-spacing-01);
|
|
127
152
|
}
|
|
128
153
|
}
|
|
129
154
|
}
|
|
130
155
|
|
|
131
156
|
@media (--dev-dot-viewport) {
|
|
132
157
|
@nest .hasSide & {
|
|
133
|
-
padding: var(--
|
|
158
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-05);
|
|
134
159
|
margin-bottom: 0;
|
|
135
160
|
|
|
136
161
|
&:hover {
|
|
137
|
-
background-color: var(--
|
|
138
|
-
border-radius: var(--
|
|
162
|
+
background-color: var(--mds-color-surface-interactive-hover);
|
|
163
|
+
border-radius: var(--mds-spacing-01);
|
|
139
164
|
}
|
|
140
165
|
}
|
|
141
166
|
}
|
|
@@ -152,8 +177,8 @@
|
|
|
152
177
|
@nest .noSide & {
|
|
153
178
|
& svg {
|
|
154
179
|
@media (--large) {
|
|
155
|
-
height: var(--
|
|
156
|
-
width: var(--
|
|
180
|
+
height: var(--mds-spacing-08);
|
|
181
|
+
width: var(--mds-spacing-08);
|
|
157
182
|
}
|
|
158
183
|
}
|
|
159
184
|
}
|
|
@@ -161,8 +186,8 @@
|
|
|
161
186
|
@nest .hasSide & {
|
|
162
187
|
& svg {
|
|
163
188
|
@media (--dev-dot-viewport) {
|
|
164
|
-
height: var(--
|
|
165
|
-
width: var(--
|
|
189
|
+
height: var(--mds-spacing-08);
|
|
190
|
+
width: var(--mds-spacing-08);
|
|
166
191
|
}
|
|
167
192
|
}
|
|
168
193
|
}
|
|
@@ -171,7 +196,7 @@
|
|
|
171
196
|
.productTextContent {
|
|
172
197
|
display: flex;
|
|
173
198
|
flex-direction: column;
|
|
174
|
-
color: var(--
|
|
199
|
+
color: var(--mds-color-foreground-strong);
|
|
175
200
|
}
|
|
176
201
|
|
|
177
202
|
.productDesc {
|
|
@@ -179,12 +204,12 @@
|
|
|
179
204
|
font-size: 14px;
|
|
180
205
|
line-height: 20px;
|
|
181
206
|
letter-spacing: 0.0125em;
|
|
182
|
-
color: var(--
|
|
207
|
+
color: var(--mds-color-foreground-faint);
|
|
183
208
|
}
|
|
184
209
|
|
|
185
210
|
.focusIndicator {
|
|
186
211
|
&:focus {
|
|
187
|
-
outline: 2px solid var(--
|
|
212
|
+
outline: 2px solid var(--mds-color-focus-action-internal);
|
|
188
213
|
outline-style: auto;
|
|
189
214
|
}
|
|
190
215
|
}
|
|
@@ -195,30 +220,42 @@
|
|
|
195
220
|
justify-content: space-between;
|
|
196
221
|
flex-direction: column;
|
|
197
222
|
|
|
223
|
+
@nest .topPromo & {
|
|
224
|
+
justify-content: flex-start;
|
|
225
|
+
}
|
|
226
|
+
|
|
198
227
|
@media (--large) {
|
|
199
228
|
@nest .noSide & {
|
|
200
|
-
padding: var(--
|
|
201
|
-
var(--
|
|
229
|
+
padding: var(--mds-spacing-05) 0 var(--mds-spacing-05)
|
|
230
|
+
var(--mds-spacing-04);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@nest .topPromo & {
|
|
234
|
+
padding-bottom: var(--mds-spacing-04);
|
|
202
235
|
}
|
|
203
236
|
}
|
|
204
237
|
|
|
205
238
|
@media (--dev-dot-viewport) {
|
|
206
239
|
@nest .hasSide & {
|
|
207
|
-
padding: var(--
|
|
208
|
-
var(--
|
|
240
|
+
padding: var(--mds-spacing-07) 0 var(--mds-spacing-09)
|
|
241
|
+
var(--mds-spacing-04);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@nest .topPromo & {
|
|
245
|
+
padding-bottom: var(--mds-spacing-04);
|
|
209
246
|
}
|
|
210
247
|
}
|
|
211
248
|
}
|
|
212
249
|
|
|
213
250
|
.sidePanel {
|
|
214
251
|
height: 100%;
|
|
215
|
-
background: var(--
|
|
252
|
+
background: var(--mds-color-surface-faint);
|
|
216
253
|
display: flex;
|
|
217
254
|
flex-direction: column;
|
|
218
|
-
gap: var(--
|
|
255
|
+
gap: var(--mds-spacing-05);
|
|
219
256
|
margin: 0;
|
|
220
|
-
padding: var(--
|
|
221
|
-
var(--
|
|
257
|
+
padding: var(--mds-spacing-07) var(--mds-spacing-04) var(--mds-spacing-09)
|
|
258
|
+
var(--mds-spacing-07);
|
|
222
259
|
}
|
|
223
260
|
|
|
224
261
|
.sidePanelItems {
|
|
@@ -227,24 +264,24 @@
|
|
|
227
264
|
padding: 0;
|
|
228
265
|
display: grid;
|
|
229
266
|
grid-template-columns: 1fr;
|
|
230
|
-
gap: var(--
|
|
267
|
+
gap: var(--mds-spacing-07);
|
|
231
268
|
|
|
232
269
|
@media (--dev-dot-viewport) {
|
|
233
|
-
gap: var(--
|
|
270
|
+
gap: var(--mds-spacing-05);
|
|
234
271
|
}
|
|
235
272
|
}
|
|
236
273
|
|
|
237
274
|
/* Lifted from .productWrapper */
|
|
238
275
|
.sidePanelItem {
|
|
239
276
|
display: flex;
|
|
240
|
-
gap: var(--
|
|
277
|
+
gap: var(--mds-spacing-05);
|
|
241
278
|
|
|
242
279
|
@media (--dev-dot-viewport) {
|
|
243
|
-
padding: var(--
|
|
280
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-05);
|
|
244
281
|
|
|
245
282
|
&:hover {
|
|
246
|
-
background-color: var(--
|
|
247
|
-
border-radius: var(--
|
|
283
|
+
background-color: var(--mds-color-surface-interactive-hover);
|
|
284
|
+
border-radius: var(--mds-spacing-01);
|
|
248
285
|
}
|
|
249
286
|
}
|
|
250
287
|
}
|
|
@@ -252,30 +289,30 @@
|
|
|
252
289
|
/* Lifted from:
|
|
253
290
|
packages/react-components/src/components/nav-panel/components/link-list/style.module.css */
|
|
254
291
|
.iconBackground {
|
|
255
|
-
background: var(--
|
|
256
|
-
height: var(--
|
|
257
|
-
width: var(--
|
|
292
|
+
background: var(--mds-color-foreground-high-contrast);
|
|
293
|
+
height: var(--mds-spacing-08);
|
|
294
|
+
width: var(--mds-spacing-08);
|
|
258
295
|
display: flex;
|
|
259
296
|
align-items: center;
|
|
260
297
|
justify-content: center;
|
|
261
298
|
border-radius: 3px;
|
|
262
299
|
flex: none;
|
|
263
300
|
margin-top: 3px;
|
|
264
|
-
border: 1px solid var(--
|
|
301
|
+
border: 1px solid var(--mds-color-border-primary);
|
|
265
302
|
}
|
|
266
303
|
|
|
267
304
|
/* Lifted from .productTextContent */
|
|
268
305
|
.sidePanelItemContent {
|
|
269
306
|
display: flex;
|
|
270
307
|
flex-direction: column;
|
|
271
|
-
color: var(--
|
|
308
|
+
color: var(--mds-color-foreground-strong);
|
|
272
309
|
}
|
|
273
310
|
|
|
274
311
|
.sidePanelItemDesc {
|
|
275
312
|
font-weight: 400;
|
|
276
313
|
font-size: 13px;
|
|
277
314
|
line-height: 18px;
|
|
278
|
-
color: var(--
|
|
315
|
+
color: var(--mds-color-foreground-primary);
|
|
279
316
|
}
|
|
280
317
|
|
|
281
318
|
/* Branding exception classnames */
|
|
@@ -283,10 +320,10 @@ packages/react-components/src/components/nav-panel/components/link-list/style.mo
|
|
|
283
320
|
/* Allows switching to a dark-mode-specific color for Terraform */
|
|
284
321
|
.terraform {
|
|
285
322
|
& use {
|
|
286
|
-
fill: var(--
|
|
323
|
+
fill: var(--mds-color-terraform-brand);
|
|
287
324
|
|
|
288
325
|
@nest [data-theme='dark'] & {
|
|
289
|
-
fill: var(--
|
|
326
|
+
fill: var(--mds-color-terraform-foreground);
|
|
290
327
|
}
|
|
291
328
|
}
|
|
292
329
|
|
|
@@ -301,15 +338,58 @@ packages/react-components/src/components/nav-panel/components/link-list/style.mo
|
|
|
301
338
|
*/
|
|
302
339
|
.hcpVaultSecrets,
|
|
303
340
|
.hcpVaultRadar {
|
|
304
|
-
padding: var(--
|
|
305
|
-
border: 2px solid var(--
|
|
341
|
+
padding: var(--mds-spacing-01);
|
|
342
|
+
border: 2px solid var(--mds-color-vault-brand);
|
|
306
343
|
border-radius: 3px;
|
|
307
344
|
|
|
308
345
|
& use {
|
|
309
|
-
fill: var(--
|
|
346
|
+
fill: var(--mds-color-foreground-strong);
|
|
310
347
|
}
|
|
311
348
|
|
|
312
349
|
& path {
|
|
313
350
|
fill: inherit;
|
|
314
351
|
}
|
|
315
352
|
}
|
|
353
|
+
|
|
354
|
+
.sidePanelText {
|
|
355
|
+
font-weight: var(--mds-typography-font-weight-semibold);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.productCategoryHasGroup {
|
|
359
|
+
& .productList {
|
|
360
|
+
padding-left: 0;
|
|
361
|
+
padding-right: 0;
|
|
362
|
+
padding-top: 0;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
& .productWrapper {
|
|
366
|
+
gap: var(--mds-spacing-04);
|
|
367
|
+
|
|
368
|
+
@media (--small) {
|
|
369
|
+
padding: var(--mds-spacing-03) var(--mds-spacing-05);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
& .productLogo {
|
|
374
|
+
margin-top: 3px;
|
|
375
|
+
height: 32px;
|
|
376
|
+
width: 32px;
|
|
377
|
+
min-width: 32px;
|
|
378
|
+
|
|
379
|
+
& svg {
|
|
380
|
+
width: 100%;
|
|
381
|
+
height: 100%;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
& .terraform {
|
|
386
|
+
width: 100%;
|
|
387
|
+
height: 100%;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.productGroupLink {
|
|
392
|
+
min-width: 100%;
|
|
393
|
+
max-width: 100%;
|
|
394
|
+
margin-bottom: var(--mds-spacing-03);
|
|
395
|
+
}
|
|
@@ -3,13 +3,12 @@ import { allSupportedLocales } from '../supported-locales'
|
|
|
3
3
|
|
|
4
4
|
export const getLocalizedLinkProps = (
|
|
5
5
|
url: string,
|
|
6
|
-
locale?: string
|
|
7
|
-
forceExternal?: boolean
|
|
6
|
+
locale?: string
|
|
8
7
|
): {
|
|
9
8
|
href: string
|
|
10
9
|
hrefLang: string | undefined
|
|
11
10
|
} => {
|
|
12
|
-
const parsedHref = parseUrl(url
|
|
11
|
+
const parsedHref = parseUrl(url).href
|
|
13
12
|
|
|
14
13
|
// example: /en
|
|
15
14
|
const hrefIsLocalizedHomepage = allSupportedLocales.includes(
|
|
@@ -34,18 +34,11 @@ const containsHashiCorpDestination = (str: string): boolean =>
|
|
|
34
34
|
*
|
|
35
35
|
* @throws {Error} Throws an error if the URL is undefined or invalid.
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
|
-
// @TODO: delete forceExternal when io sites are shutdown
|
|
39
|
-
|
|
40
|
-
export function parseUrl(
|
|
41
|
-
url: string | undefined,
|
|
42
|
-
forceExternal?: boolean
|
|
43
|
-
): {
|
|
37
|
+
export function parseUrl(url: string | undefined): {
|
|
44
38
|
linkType: 'inbound' | 'outbound' | ''
|
|
45
39
|
href: string
|
|
46
40
|
} {
|
|
47
41
|
if (!url) {
|
|
48
|
-
console.log('No url to parse, returning empty string')
|
|
49
42
|
return { linkType: '', href: '' }
|
|
50
43
|
}
|
|
51
44
|
|
|
@@ -53,7 +46,7 @@ export function parseUrl(
|
|
|
53
46
|
return { linkType: 'inbound', href: url }
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
if (
|
|
49
|
+
if (isInternal(url)) {
|
|
57
50
|
try {
|
|
58
51
|
const { pathname, search, hash } = new URL(url)
|
|
59
52
|
const href = pathname + search + hash
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import posthog from 'posthog-js'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A custom hook to send a custom event to PostHog.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} eventName - The name of the custom event to be tracked in PostHog.
|
|
7
|
+
* @param {Record<string, any>} properties - A key-value object containing properties associated with the event.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const MyComponent = () => {
|
|
11
|
+
* sendPosthogEvent('button_click', { buttonId: 'submit', action: 'clicked' });
|
|
12
|
+
* return <button id="submit">Submit</button>;
|
|
13
|
+
* };
|
|
14
|
+
*/
|
|
15
|
+
const sendPosthogEvent = (
|
|
16
|
+
eventName: string,
|
|
17
|
+
properties: Record<string, any>
|
|
18
|
+
) => {
|
|
19
|
+
posthog.capture(eventName, properties)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default sendPosthogEvent
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import sendPosthogEvent from '../send-posthog-event'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Pushes a 'Nav link click' custom event to
|
|
5
|
-
* A wrapper around the
|
|
4
|
+
* Pushes a 'Nav link click' custom event to PostHog.
|
|
5
|
+
* A wrapper around the PostHog custom event method.
|
|
6
6
|
*
|
|
7
7
|
* @param {string} name - The name of the nav link
|
|
8
8
|
* @param {string} href - The href for the nav link
|
|
@@ -14,7 +14,7 @@ export const trackNavClickEvent = (
|
|
|
14
14
|
href: string,
|
|
15
15
|
section: string
|
|
16
16
|
) => {
|
|
17
|
-
|
|
17
|
+
sendPosthogEvent('Nav link click', {
|
|
18
18
|
name,
|
|
19
19
|
href,
|
|
20
20
|
section,
|