@hashicorp/react-components 0.0.0-canary.06ed51b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/.eslintrc.js +4 -0
  2. package/.stylelintrc.js +3 -0
  3. package/.test/setup-vitest.js +1 -0
  4. package/README.md +3 -0
  5. package/global.d.ts +6 -0
  6. package/package.json +34 -0
  7. package/postcss.config.js +21 -0
  8. package/src/components/actions/index.tsx +107 -0
  9. package/src/components/actions/style.module.css +28 -0
  10. package/src/components/actions/types.ts +73 -0
  11. package/src/components/call-to-action/index.tsx +205 -0
  12. package/src/components/call-to-action/styles/variant-centered.module.css +93 -0
  13. package/src/components/call-to-action/styles/variant-compact-grid.module.css +88 -0
  14. package/src/components/call-to-action/styles/variant-compact.module.css +91 -0
  15. package/src/components/call-to-action/styles/variant-links.module.css +85 -0
  16. package/src/components/card/README.md +11 -0
  17. package/src/components/card/card.tsx +45 -0
  18. package/src/components/card/index.test.tsx +69 -0
  19. package/src/components/card/index.tsx +14 -0
  20. package/src/components/card/newsroom-card/index.test.tsx +39 -0
  21. package/src/components/card/newsroom-card/index.tsx +37 -0
  22. package/src/components/card/newsroom-card/style.module.css +12 -0
  23. package/src/components/card/partner-card/index.test.tsx +57 -0
  24. package/src/components/card/partner-card/index.tsx +69 -0
  25. package/src/components/card/partner-card/style.module.css +24 -0
  26. package/src/components/card/person-card/index.test.tsx +71 -0
  27. package/src/components/card/person-card/index.tsx +93 -0
  28. package/src/components/card/person-card/style.module.css +33 -0
  29. package/src/components/card/primitives.tsx +176 -0
  30. package/src/components/card/promo-card/index.tsx +51 -0
  31. package/src/components/card/resource-card/index.test.tsx +48 -0
  32. package/src/components/card/resource-card/index.tsx +37 -0
  33. package/src/components/card/style.module.css +145 -0
  34. package/src/components/card/types.ts +66 -0
  35. package/src/components/card/unified-card/index.tsx +64 -0
  36. package/src/components/consent-manager/README.md +73 -0
  37. package/src/components/consent-manager/components/banner/banner.module.css +23 -0
  38. package/src/components/consent-manager/components/banner/banner.test.tsx +31 -0
  39. package/src/components/consent-manager/components/banner/banner.tsx +73 -0
  40. package/src/components/consent-manager/components/dialog/dialog.module.css +145 -0
  41. package/src/components/consent-manager/components/dialog/dialog.test.tsx +194 -0
  42. package/src/components/consent-manager/components/dialog/dialog.tsx +339 -0
  43. package/src/components/consent-manager/img/icn_close.tsx +19 -0
  44. package/src/components/consent-manager/index.test.tsx +334 -0
  45. package/src/components/consent-manager/index.tsx +186 -0
  46. package/src/components/consent-manager/loader/README.md +29 -0
  47. package/src/components/consent-manager/loader/categories.ts +22 -0
  48. package/src/components/consent-manager/loader/index.tsx +94 -0
  49. package/src/components/consent-manager/loader/presets/enterprise.ts +12 -0
  50. package/src/components/consent-manager/loader/presets/oss.ts +10 -0
  51. package/src/components/consent-manager/loader/services.ts +45 -0
  52. package/src/components/consent-manager/scripts/custom.tsx +59 -0
  53. package/src/components/consent-manager/scripts/segment.tsx +87 -0
  54. package/src/components/consent-manager/style.module.css +9 -0
  55. package/src/components/consent-manager/types.ts +55 -0
  56. package/src/components/consent-manager/util/cookies.test.ts +75 -0
  57. package/src/components/consent-manager/util/cookies.ts +70 -0
  58. package/src/components/consent-manager/util/integrations.test.ts +115 -0
  59. package/src/components/consent-manager/util/integrations.ts +110 -0
  60. package/src/components/intro/index.tsx +82 -0
  61. package/src/components/intro/style.module.css +67 -0
  62. package/src/components/intro/types.ts +44 -0
  63. package/src/components/marketo-form/CHANGELOG.md +122 -0
  64. package/src/components/marketo-form/README.md +1 -0
  65. package/src/components/marketo-form/contexts/FormMetadata.ts +11 -0
  66. package/src/components/marketo-form/docs.mdx +197 -0
  67. package/src/components/marketo-form/fixtures/index.ts +185 -0
  68. package/src/components/marketo-form/form/index.tsx +369 -0
  69. package/src/components/marketo-form/index.test.tsx +320 -0
  70. package/src/components/marketo-form/index.ts +11 -0
  71. package/src/components/marketo-form/package.original.json +30 -0
  72. package/src/components/marketo-form/partials/error-message/index.tsx +12 -0
  73. package/src/components/marketo-form/partials/error-message/style.module.css +13 -0
  74. package/src/components/marketo-form/partials/field/index.tsx +90 -0
  75. package/src/components/marketo-form/partials/field-wrapper/index.tsx +26 -0
  76. package/src/components/marketo-form/partials/fields/checkbox-field/index.tsx +32 -0
  77. package/src/components/marketo-form/partials/fields/email-field/index.tsx +35 -0
  78. package/src/components/marketo-form/partials/fields/form-page-url-field/index.tsx +21 -0
  79. package/src/components/marketo-form/partials/fields/hidden-field/index.tsx +37 -0
  80. package/src/components/marketo-form/partials/fields/htmltext-field/index.tsx +21 -0
  81. package/src/components/marketo-form/partials/fields/htmltext-field/style.module.css +18 -0
  82. package/src/components/marketo-form/partials/fields/name-field/index.tsx +19 -0
  83. package/src/components/marketo-form/partials/fields/name-field/style.module.css +13 -0
  84. package/src/components/marketo-form/partials/fields/radio-buttons-field/index.tsx +48 -0
  85. package/src/components/marketo-form/partials/fields/select-field/index.tsx +39 -0
  86. package/src/components/marketo-form/partials/fields/select-field/style.module.css +5 -0
  87. package/src/components/marketo-form/partials/fields/telephone-field/index.tsx +30 -0
  88. package/src/components/marketo-form/partials/fields/text-field/index.tsx +30 -0
  89. package/src/components/marketo-form/partials/fields/textarea-field/index.tsx +29 -0
  90. package/src/components/marketo-form/partials/label/index.tsx +24 -0
  91. package/src/components/marketo-form/partials/label/style.module.css +12 -0
  92. package/src/components/marketo-form/partials/visibility-rule/index.tsx +84 -0
  93. package/src/components/marketo-form/props.js +66 -0
  94. package/src/components/marketo-form/server/api-routes.ts +109 -0
  95. package/src/components/marketo-form/server/client.ts +98 -0
  96. package/src/components/marketo-form/server/index.ts +8 -0
  97. package/src/components/marketo-form/types.ts +268 -0
  98. package/src/components/marketo-form/utils.test.tsx +103 -0
  99. package/src/components/marketo-form/utils.ts +449 -0
  100. package/src/components/nav-panel/components/link-list/index.tsx +88 -0
  101. package/src/components/nav-panel/components/link-list/style.module.css +57 -0
  102. package/src/components/nav-panel/components/panel/column/index.tsx +24 -0
  103. package/src/components/nav-panel/components/panel/column/style.module.css +24 -0
  104. package/src/components/nav-panel/components/panel/index.tsx +4 -0
  105. package/src/components/nav-panel/components/panel/root/index.tsx +20 -0
  106. package/src/components/nav-panel/components/panel/root/style.module.css +30 -0
  107. package/src/components/nav-panel/components/promo/index.tsx +86 -0
  108. package/src/components/nav-panel/components/promo/style.module.css +113 -0
  109. package/src/components/nav-panel/index.tsx +6 -0
  110. package/src/components/nav-panel/product-panel/index.tsx +170 -0
  111. package/src/components/nav-panel/product-panel/style.module.css +296 -0
  112. package/src/components/nav-panel/standard-panel/index.tsx +44 -0
  113. package/src/components/nav-panel/standard-panel/style.module.css +11 -0
  114. package/src/components/next-steps/index.tsx +137 -0
  115. package/src/components/next-steps/style.module.css +270 -0
  116. package/src/components/next-steps/types.ts +63 -0
  117. package/src/components/product-badge/index.test.tsx +11 -0
  118. package/src/components/product-badge/index.tsx +42 -0
  119. package/src/components/product-badge/style.module.css +76 -0
  120. package/src/components/products-used/index.tsx +84 -0
  121. package/src/components/products-used/style.module.css +87 -0
  122. package/src/components/products-used/types.ts +31 -0
  123. package/src/components/related-content/index.test.tsx +74 -0
  124. package/src/components/related-content/index.tsx +56 -0
  125. package/src/components/related-content/style.module.css +89 -0
  126. package/src/components/related-content/types.ts +21 -0
  127. package/src/components/subnav/helpers/areBasePathsMatching.ts +13 -0
  128. package/src/components/subnav/helpers/traverse/index.ts +42 -0
  129. package/src/components/subnav/helpers/useHeightRef.ts +42 -0
  130. package/src/components/subnav/helpers/useNavRef.ts +30 -0
  131. package/src/components/subnav/helpers/useOverflowRef.ts +85 -0
  132. package/src/components/subnav/helpers/useStuckRef.ts +51 -0
  133. package/src/components/subnav/index.tsx +199 -0
  134. package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.test.ts +26 -0
  135. package/src/components/subnav/partials/CtaLinks/github-stars-link/formatStarCount/index.ts +22 -0
  136. package/src/components/subnav/partials/CtaLinks/github-stars-link/index.tsx +87 -0
  137. package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.test.ts +29 -0
  138. package/src/components/subnav/partials/CtaLinks/github-stars-link/parseGithubUrl/index.ts +32 -0
  139. package/src/components/subnav/partials/CtaLinks/github-stars-link/style.module.css +85 -0
  140. package/src/components/subnav/partials/CtaLinks/icons/github-logo.js +20 -0
  141. package/src/components/subnav/partials/CtaLinks/icons/github.svg.js +7 -0
  142. package/src/components/subnav/partials/CtaLinks/icons/star.js +20 -0
  143. package/src/components/subnav/partials/CtaLinks/index.tsx +130 -0
  144. package/src/components/subnav/partials/CtaLinks/style.module.css +45 -0
  145. package/src/components/subnav/partials/DropdownTrigger/index.tsx +35 -0
  146. package/src/components/subnav/partials/DropdownTrigger/style.module.css +36 -0
  147. package/src/components/subnav/partials/MenuItemsDefault/index.tsx +151 -0
  148. package/src/components/subnav/partials/MenuItemsDefault/style.module.css +91 -0
  149. package/src/components/subnav/partials/MenuItemsOverflow/index.tsx +139 -0
  150. package/src/components/subnav/partials/MenuItemsOverflow/style.module.css +82 -0
  151. package/src/components/subnav/partials/TitleLink/index.tsx +113 -0
  152. package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-dark.ts +9 -0
  153. package/src/components/subnav/partials/TitleLink/mktg-logos/all-community-product-logos_on-light.ts +9 -0
  154. package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-dark.ts +23 -0
  155. package/src/components/subnav/partials/TitleLink/mktg-logos/all-primary-logos_on-light.ts +23 -0
  156. package/src/components/subnav/partials/TitleLink/style.module.css +43 -0
  157. package/src/components/subnav/partials/nav-item-text/index.tsx +37 -0
  158. package/src/components/subnav/partials/nav-item-text/style.module.css +15 -0
  159. package/src/components/subnav/style.module.css +68 -0
  160. package/src/components/subnav/subnav-consts.ts +1 -0
  161. package/src/components/subnav/theme.module.css +50 -0
  162. package/src/lib/parse-url/index.test.ts +30 -0
  163. package/src/lib/parse-url/index.ts +32 -0
  164. package/src/lib/track-nav-click-event/index.ts +22 -0
  165. package/src/lib/v/index.ts +11 -0
  166. package/tsconfig.json +14 -0
  167. package/vitest.config.mts +12 -0
@@ -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: 1210px);
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-05);
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,4 @@
1
+ import Root from './root'
2
+ import Column from './column'
3
+
4
+ export { Root, Column }
@@ -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: 1210px);
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 { v } 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]: v(theme) === 'hashidays',
55
+ [s.hashiconf]: v(theme) === 'hashiconf',
56
+ })}
57
+ >
58
+ <FlightIcon name={v(icon)} />
59
+ </div>
60
+ )}
61
+ <div className={s.rightContent}>
62
+ <div>
63
+ <div
64
+ className={classNames(s.title, {
65
+ [s.hashidays]: v(theme) === 'hashidays',
66
+ [s.hashiconf]: v(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,113 @@
1
+ @custom-media --dev-dot-viewport (min-width: 1210px);
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-05);
13
+
14
+ @media (--large) {
15
+ &.noSide {
16
+ margin: 0;
17
+ width: min-content;
18
+ min-width: 100%;
19
+ }
20
+ }
21
+
22
+ @media (--dev-dot-viewport) {
23
+ &.hasSide {
24
+ margin: 0;
25
+ width: min-content;
26
+ min-width: 100%;
27
+ }
28
+ }
29
+ }
30
+
31
+ .rightContent {
32
+ display: flex;
33
+ flex-wrap: wrap;
34
+ gap: var(--hdsplus-spacing-03);
35
+ width: 100%;
36
+ justify-content: space-between;
37
+ }
38
+
39
+ .title {
40
+ font-weight: var(--font-weight-semi-bold);
41
+ }
42
+
43
+ .description {
44
+ font-size: var(--hdsplus-typography-body-200-font-size);
45
+ font-weight: var(--token-typography-font-weight-regular);
46
+ margin-top: var(--hdsplus-spacing-01);
47
+ }
48
+
49
+ .icon {
50
+ display: none;
51
+
52
+ @media (--large) {
53
+ @nest .noSide & {
54
+ display: block;
55
+ margin-top: 3px;
56
+ }
57
+ }
58
+
59
+ @media (--dev-dot-viewport) {
60
+ @nest .hasSide & {
61
+ display: block;
62
+ margin-top: 3px;
63
+ }
64
+ }
65
+ }
66
+
67
+ .link {
68
+ color: var(--token-color-foreground-strong);
69
+ display: flex;
70
+ flex-direction: row;
71
+ align-items: center;
72
+ gap: var(--hdsplus-spacing-02);
73
+
74
+ &:hover {
75
+ text-decoration: underline;
76
+ }
77
+
78
+ &:focus {
79
+ outline: 2px solid var(--token-color-focus-action-internal);
80
+ outline-style: auto;
81
+ }
82
+ }
83
+
84
+ .hashidays {
85
+ background: linear-gradient(
86
+ 90deg,
87
+ #7b54b6 0%,
88
+ #4c69d8 74.77%,
89
+ #60d0dc 115.93%
90
+ );
91
+ -webkit-background-clip: text;
92
+ -webkit-text-fill-color: transparent;
93
+ max-width: fit-content;
94
+
95
+ & svg {
96
+ color: #7956b9;
97
+ }
98
+ }
99
+
100
+ .hashiconf {
101
+ background: linear-gradient(
102
+ to right,
103
+ var(--token-color-terraform-foreground),
104
+ var(--token-color-vagrant-foreground)
105
+ );
106
+ -webkit-background-clip: text;
107
+ -webkit-text-fill-color: transparent;
108
+ max-width: fit-content;
109
+
110
+ & svg {
111
+ color: var(--token-color-terraform-foreground);
112
+ }
113
+ }
@@ -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,170 @@
1
+ import { CSSProperties } from 'react'
2
+ import classNames from 'classnames'
3
+ import Link from 'next/link'
4
+ import * as NavPanel from '../components/panel'
5
+ import Promo, { type PromoProps } from '../components/promo'
6
+ import { Products } from '@hashicorp/platform-product-meta'
7
+ import FlightIcon from '@hashicorp/react-design-system-components/src/components/flight-icon'
8
+ import { TextPlus } from '@hashicorp/react-design-system-components/src/components/text'
9
+ import { parseUrl } from '../../../lib/parse-url'
10
+ import { trackNavClickEvent } from '../../../lib/track-nav-click-event'
11
+ import * as NavigationMenu from '@radix-ui/react-navigation-menu'
12
+ import s from './style.module.css'
13
+
14
+ const PRODUCT_LOGO_MAP = new Map([
15
+ ['Terraform', 'terraform-fill-color'],
16
+ ['Packer', 'packer-fill-color'],
17
+ ['Vault', 'vault-fill-color'],
18
+ ['Boundary', 'boundary-fill-color'],
19
+ ['Consul', 'consul-fill-color'],
20
+ ['Nomad', 'nomad-fill-color'],
21
+ ['Waypoint', 'waypoint-fill-color'],
22
+ ['Vagrant', 'vagrant-fill-color'],
23
+ ['HCP Vault Secrets', 'vault-secrets'],
24
+ ['HCP Vault Radar', 'vault-radar'],
25
+ ])
26
+
27
+ const PRODUCT_LOGO_EXCEPTION_CLASSNAMES = {
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
67
+ className={s.productList}
68
+ // Dynamically calculate row count based on number of items divided by expected columns
69
+ style={
70
+ {
71
+ '--row-count-above-mobile': Math.ceil(
72
+ products.length / 2
73
+ ),
74
+ } as CSSProperties
75
+ }
76
+ >
77
+ {products.map((product) => {
78
+ return (
79
+ <li key={product.url}>
80
+ <NavProduct {...product} />
81
+ </li>
82
+ )
83
+ })}
84
+ </ul>
85
+ </li>
86
+ )
87
+ })}
88
+ </ul>
89
+ </NavPanel.Column>
90
+ {promo ? <Promo {...promo} hasSidePanel={Boolean(sidePanel)} /> : null}
91
+ </div>
92
+
93
+ {sidePanel ? (
94
+ <NavPanel.Column className={s.sidePanel}>
95
+ <TextPlus.Body size="200" weight="semibold">
96
+ {sidePanel.label}
97
+ </TextPlus.Body>
98
+
99
+ {/* ! TODO Replace the below list with the <LinkList /> component,
100
+ That component will require a refactor to support greater customization
101
+ Ticket:
102
+ https://app.asana.com/0/1206176289707208/1208162145034615/f
103
+ */}
104
+ <ul className={s.sidePanelItems}>
105
+ {sidePanel.navItems.map(({ icon, title, description, url }) => {
106
+ return (
107
+ <li key={title}>
108
+ <Link href={parseUrl(url).href} className={s.sidePanelItem}>
109
+ <div className={s.iconBackground}>
110
+ <FlightIcon
111
+ size={16}
112
+ name={icon}
113
+ color="var(--token-color-foreground-faint)"
114
+ />
115
+ </div>
116
+ <div className={s.sidePanelItemContent}>
117
+ <TextPlus.Body size="200" weight="semibold" tag="span">
118
+ {title}
119
+ </TextPlus.Body>
120
+ <span className={s.sidePanelItemDesc}>{description}</span>
121
+ </div>
122
+ </Link>
123
+ </li>
124
+ )
125
+ })}
126
+ </ul>
127
+ </NavPanel.Column>
128
+ ) : null}
129
+ </NavPanel.Root>
130
+ )
131
+ }
132
+
133
+ export interface NavProductProps {
134
+ url: string
135
+ product: Products | string
136
+ description: string
137
+ }
138
+
139
+ function NavProduct({ url, product, description }: NavProductProps) {
140
+ return (
141
+ <NavigationMenu.Link asChild>
142
+ <Link
143
+ href={parseUrl(url).href}
144
+ onClickCapture={() => {
145
+ trackNavClickEvent(product, url, 'products')
146
+ }}
147
+ className={s.focusIndicator}
148
+ >
149
+ <div className={s.productWrapper}>
150
+ <div className={s.productLogo}>
151
+ <FlightIcon
152
+ name={PRODUCT_LOGO_MAP.get(product) ?? 'hashicorp-fill-color'}
153
+ className={
154
+ PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]
155
+ ? s[PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]]
156
+ : undefined
157
+ }
158
+ />
159
+ </div>
160
+ <div className={s.productTextContent}>
161
+ <span>{product}</span>
162
+ <span className={s.productDesc}>{description}</span>
163
+ </div>
164
+ </div>
165
+ </Link>
166
+ </NavigationMenu.Link>
167
+ )
168
+ }
169
+
170
+ export default ProductPanel