Skip to content

Commit 074465d

Browse files
committed
feature description modifies with title
1 parent b52ad10 commit 074465d

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

src/Common/Types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export interface TippyCustomizedProps {
100100
iconSize?: number // E.g. 16, 20, etc.. Currently, there are around 12 sizes supported. Check `icons.css` or `base.scss` for supported sizes or add new size (class names starts with `icon-dim-`).
101101
onImageLoadError?: (e) => void
102102
onClose?: () => void
103-
infoText?: string
103+
infoText?: React.ReactNode
104104
showCloseButton?: boolean
105105
arrow?: boolean
106106
interactive?: boolean

src/Shared/Components/FeatureDescription/FeatureTitleWithInfo.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ import { DescriptorProps } from './types'
1919
import { ReactComponent as ICHelpOutline } from '../../../Assets/Icon/ic-help-outline.svg'
2020
import { BreadCrumb } from '../../../Common'
2121
import { FeatureDescriptionModal } from './FeatureDescriptionModal'
22+
import { InfoIconTippy } from '../InfoIconTippy'
2223

2324
const FeatureTitleWithInfo = ({
2425
additionalContainerClasses,
25-
breadCrumbs,
26+
breadCrumbs = [],
2627
children,
2728
iconClassName,
2829
title,
2930
renderDescriptionContent,
3031
closeModalText,
3132
docLink,
3233
SVGImage,
34+
showInfoIconTippy,
3335
}: DescriptorProps) => {
3436
const [showFeatureDescriptionModal, setShowFeatureDescriptionModal] = useState(false)
3537
const onClickInfoIcon = () => {
@@ -39,15 +41,37 @@ const FeatureTitleWithInfo = ({
3941
const closeModal = () => {
4042
setShowFeatureDescriptionModal(false)
4143
}
44+
45+
const renderTitle = () => {
46+
if (breadCrumbs)
47+
<div className="flexbox dc__align-items-center dc__gap-4">
48+
<BreadCrumb breadcrumbs={breadCrumbs} />
49+
<ICHelpOutline className={`${iconClassName} icon-dim-20 cursor fcn-6`} onClick={onClickInfoIcon} />
50+
</div>
51+
else if (showInfoIconTippy) {
52+
return (
53+
<div>
54+
{title}
55+
<InfoIconTippy
56+
heading={title}
57+
infoText={renderDescriptionContent()}
58+
iconClassName={iconClassName}
59+
documentationLink={docLink}
60+
documentationLinkText={docLink}
61+
dataTestid="info-tippy-button"
62+
/>
63+
</div>
64+
)
65+
}
66+
return title
67+
}
68+
4269
return (
4370
<>
4471
<div
4572
className={`feature-description flexbox dc__content-space dc__align-items-center w-100 ${additionalContainerClasses ?? ''}`}
4673
>
47-
<div className="flexbox dc__align-items-center dc__gap-4">
48-
<BreadCrumb breadcrumbs={breadCrumbs} />
49-
<ICHelpOutline className={`${iconClassName} icon-dim-20 cursor fcn-6`} onClick={onClickInfoIcon} />
50-
</div>
74+
{renderTitle()}
5175

5276
{children}
5377
</div>

src/Shared/Components/FeatureDescription/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17+
import React, { ReactNode } from 'react'
1718
import { ImageType } from '../../../Common'
1819
import { Breadcrumb } from '../../../Common/BreadCrumb/Types'
1920

2021
export interface FeatureDescriptionModalProps {
2122
title: string
22-
renderDescriptionContent?: () => JSX.Element
23+
renderDescriptionContent?: () => ReactNode
2324
closeModalText?: string
2425
docLink?: string
2526
closeModal?: () => void
@@ -29,8 +30,9 @@ export interface FeatureDescriptionModalProps {
2930
}
3031

3132
export interface DescriptorProps extends FeatureDescriptionModalProps {
32-
breadCrumbs: Breadcrumb[]
33+
breadCrumbs?: Breadcrumb[]
3334
additionalContainerClasses?: string
3435
iconClassName?: string
3536
children?: React.ReactNode
37+
showInfoIconTippy?: boolean
3638
}

0 commit comments

Comments
 (0)