Skip to content

Commit 4c8f1eb

Browse files
committed
chore: modification in the naming of the Doclink
1 parent ad5a2aa commit 4c8f1eb

6 files changed

Lines changed: 23 additions & 8 deletions

File tree

src/Common/DocLink/DocLink.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@ import { ComponentSizeType } from '@Shared/constants'
44
import { DocLinkProps } from './types'
55
import { getDocumentationUrl } from './utils'
66

7-
export const DocLink = ({ doc, text = 'Learn more', dataTestId, showExternalIcon, onClick }: DocLinkProps) => (
7+
export const DocLink = ({
8+
docLinkKey,
9+
text = 'Learn more',
10+
dataTestId,
11+
showExternalIcon,
12+
onClick,
13+
hideVersion = false,
14+
}: DocLinkProps) => (
815
<Button
916
component={ButtonComponentType.anchor}
1017
anchorProps={{
11-
href: getDocumentationUrl(doc),
18+
href: getDocumentationUrl({ docLinkKey, hideVersion }),
1219
}}
1320
onClick={onClick}
1421
dataTestId={dataTestId}

src/Common/DocLink/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { ButtonComponentType, ButtonProps } from '@Shared/Components'
33
import { DOCUMENTATION } from './constants'
44

55
export interface DocLinkProps extends Pick<ButtonProps<ButtonComponentType.anchor>, 'onClick' | 'dataTestId'> {
6-
doc: keyof typeof DOCUMENTATION
6+
docLinkKey: keyof typeof DOCUMENTATION
77
text?: string
88
showExternalIcon?: boolean
9+
hideVersion?: boolean
910
}
11+
12+
export interface DocumentationUrlParamsType extends Pick<DocLinkProps, 'docLinkKey' | 'hideVersion'> {}

src/Common/DocLink/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import { DOCUMENTATION_HOME_PAGE, DOCUMENTATION_VERSION } from '@Common/Constants'
22

33
import { DOCUMENTATION } from './constants'
4+
import { DocumentationUrlParamsType } from './types'
45

56
export const appendUtmToUrl = (docLinkKey: keyof typeof DOCUMENTATION) =>
67
`${DOCUMENTATION[docLinkKey]}?utm_source=product`
78

8-
export const getDocumentationUrl = (docLinkKey: keyof typeof DOCUMENTATION) =>
9-
`${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${appendUtmToUrl(docLinkKey)}`
9+
export const getDocumentationUrl = ({ docLinkKey, hideVersion }: DocumentationUrlParamsType) => {
10+
if (hideVersion) {
11+
return DOCUMENTATION[docLinkKey]
12+
}
13+
return `${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${appendUtmToUrl(docLinkKey)}`
14+
}

src/Common/TippyCustomized.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export const TippyCustomized = (props: TippyCustomizedProps) => {
158158
{documentationLink && (
159159
<div className="px-12 pb-12 flexbox">
160160
<DocLink
161-
doc={'APP_CREATE'}
161+
docLinkKey={'APP_CREATE'}
162162
text={documentationLinkText}
163163
dataTestId="learn-more-about-creating-job-link"
164164
showExternalIcon

src/Shared/Components/CICDHistory/Artifacts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const Artifacts = ({
269269
{EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.StoreFiles}
270270
</span>
271271
<DocLink
272-
doc="BLOB_STORAGE"
272+
docLinkKey="BLOB_STORAGE"
273273
text={EMPTY_STATE_STATUS.ARTIFACTS_EMPTY_STATE_TEXTS.ConfigureBlobStorage}
274274
dataTestId="configure-blob-storage"
275275
/>

src/Shared/Components/CICDHistory/LogsRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ const renderBlobNotConfigured = (): JSX.Element => (
8383
<HelpIcon className="icon-dim-20 fcv-5" />
8484
<span className="fs-13 fw-4 mr-8 ml-8 text__white">Want to store logs to view later?</span>
8585

86-
<DocLink doc="BLOB_STORAGE" text="Configure blob storage" dataTestId="configure-blob-storage" />
86+
<DocLink docLinkKey="BLOB_STORAGE" text="Configure blob storage" dataTestId="configure-blob-storage" />
8787
<OpenInNew className="icon-dim-20 ml-8" />
8888
</div>
8989
</>

0 commit comments

Comments
 (0)