@hashicorp/react-components 0.0.0-canary.f1f8354 → 0.0.0-canary.f793ae5
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 +1 -1
- package/src/components/marketo-form/utils.ts +4 -0
- package/src/components/nav-panel/product-panel/index.tsx +13 -1
- package/src/components/nav-panel/product-panel/style.module.css +17 -0
- package/src/lib/parse-url/index.test.ts +4 -4
- package/src/lib/parse-url/index.ts +2 -3
- package/src/lib/v/index.ts +4 -2
package/package.json
CHANGED
|
@@ -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 }
|
|
@@ -18,9 +18,16 @@ const PRODUCT_LOGO_MAP = new Map([
|
|
|
18
18
|
['Nomad', 'nomad-fill-color'],
|
|
19
19
|
['Waypoint', 'waypoint-fill-color'],
|
|
20
20
|
['Vagrant', 'vagrant-fill-color'],
|
|
21
|
+
['HCP Vault Secrets', 'vault-secrets'],
|
|
22
|
+
['HCP Vault Radar', 'vault-radar'],
|
|
21
23
|
])
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
const PRODUCT_LOGO_EXCEPTION_CLASSNAMES = {
|
|
26
|
+
'HCP Vault Secrets': 'hcpVaultSecrets',
|
|
27
|
+
'HCP Vault Radar': 'hcpVaultRadar',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ProductsPanelProps {
|
|
24
31
|
productCategories: any
|
|
25
32
|
promo?: PromoProps
|
|
26
33
|
}
|
|
@@ -73,6 +80,11 @@ function NavProduct({ url, product, description }: NavProductProps) {
|
|
|
73
80
|
<div className={s.productLogo}>
|
|
74
81
|
<FlightIcon
|
|
75
82
|
name={PRODUCT_LOGO_MAP.get(product) ?? 'hashicorp-fill-color'}
|
|
83
|
+
className={
|
|
84
|
+
PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]
|
|
85
|
+
? s[PRODUCT_LOGO_EXCEPTION_CLASSNAMES[product]]
|
|
86
|
+
: undefined
|
|
87
|
+
}
|
|
76
88
|
/>
|
|
77
89
|
</div>
|
|
78
90
|
<div className={s.productTextContent}>
|
|
@@ -98,3 +98,20 @@
|
|
|
98
98
|
outline-style: auto;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
|
|
102
|
+
/* Branding exception classnames */
|
|
103
|
+
|
|
104
|
+
.hcpVaultSecrets,
|
|
105
|
+
.hcpVaultRadar {
|
|
106
|
+
padding: var(--hdsplus-spacing-01);
|
|
107
|
+
border: 2px solid var(--token-color-vault-brand);
|
|
108
|
+
border-radius: 3px;
|
|
109
|
+
|
|
110
|
+
& use {
|
|
111
|
+
fill: var(--token-color-foreground-strong);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
& path {
|
|
115
|
+
fill: inherit;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { parseUrl } from '.'
|
|
2
2
|
|
|
3
3
|
describe('parseUrl', () => {
|
|
4
|
-
it('
|
|
4
|
+
it('detects hashicorp.com URLs as internal', () => {
|
|
5
5
|
const url = parseUrl('https://hashicorp.com/example')
|
|
6
6
|
expect(url.href).toBe('/example')
|
|
7
7
|
expect(url.linkType).toBe('inbound')
|
|
8
8
|
})
|
|
9
9
|
|
|
10
|
-
it('
|
|
10
|
+
it('detects URLs not containing hashicorp.com as external', () => {
|
|
11
11
|
const externalUrl = 'https://google.com/example'
|
|
12
12
|
const url = parseUrl(externalUrl)
|
|
13
13
|
expect(url.href).toBe(externalUrl)
|
|
14
14
|
expect(url.linkType).toBe('outbound')
|
|
15
15
|
})
|
|
16
16
|
|
|
17
|
-
it('
|
|
17
|
+
it('detects relative URLs as internal', () => {
|
|
18
18
|
const relativeUrl = '/resources'
|
|
19
19
|
const url = parseUrl(relativeUrl)
|
|
20
20
|
expect(url.href).toBe(relativeUrl)
|
|
21
21
|
expect(url.linkType).toBe('inbound')
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
it('
|
|
24
|
+
it('leaves URL search params intact', () => {
|
|
25
25
|
const url = parseUrl(
|
|
26
26
|
'https://hashicorp.com/resources?type=case-study&products=terraform'
|
|
27
27
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function parseUrl(url: string): {
|
|
1
|
+
export function parseUrl(url: string | undefined): {
|
|
2
2
|
linkType: 'inbound' | 'outbound'
|
|
3
3
|
href: string
|
|
4
4
|
} {
|
|
@@ -27,5 +27,4 @@ const isRelative = (url) => url.startsWith('/')
|
|
|
27
27
|
const isAnchor = (url) => url.startsWith('#')
|
|
28
28
|
|
|
29
29
|
export const isInternal = (url) =>
|
|
30
|
-
url.
|
|
31
|
-
url.startsWith('https://www.hashicorp.com')
|
|
30
|
+
new URL(url).hostname.includes('hashicorp.com')
|
package/src/lib/v/index.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { vercelStegaSplit } from '@vercel/stega'
|
|
|
4
4
|
* Takes in a Vercel Visual Editing string and returns the string without
|
|
5
5
|
* hidden data.
|
|
6
6
|
*/
|
|
7
|
-
export function v<
|
|
8
|
-
|
|
7
|
+
export function v<VercelVEString extends string>(
|
|
8
|
+
s: VercelVEString
|
|
9
|
+
): VercelVEString {
|
|
10
|
+
return vercelStegaSplit(s).cleaned as VercelVEString
|
|
9
11
|
}
|