Skip to content

Commit e8d232d

Browse files
committed
feature description modal integration
1 parent 28a901b commit e8d232d

File tree

8 files changed

+683
-1575
lines changed

8 files changed

+683
-1575
lines changed

package-lock.json

Lines changed: 542 additions & 1575 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { VisibleModal, noop } from '../../../Common'
2+
import { BUTTON_TEXT, IMAGE_VARIANT } from './constant'
3+
import { FeatureDescriptionModalProps } from './types'
4+
import './featureDescription.scss'
5+
6+
export const FeatureDescriptionModal = ({
7+
image,
8+
title,
9+
renderDescriptionContent,
10+
closeModalText = BUTTON_TEXT.GOT_IT,
11+
docLink = '',
12+
closeModal,
13+
imageVariant,
14+
}: FeatureDescriptionModalProps) => {
15+
const renderDescriptionBody = () => (
16+
<div className="pl-20 pr-20 pt-16 pb-16">
17+
<div className="flex left w-100 fs-16 fw-6">{title}</div>
18+
<img
19+
src={image}
20+
className={`${imageVariant === IMAGE_VARIANT.SMALL ? 'small' : 'large'} mt-16 mb-12`}
21+
alt="feature-description"
22+
/>
23+
{typeof renderDescriptionContent === 'function' && renderDescriptionContent()}
24+
</div>
25+
)
26+
27+
const renderFooter = () => (
28+
<div
29+
className={`flex right w-100 dc__align-right pt-16 dc__border-top-n1 pb-16 pl-20 pr-20 ${docLink ? 'dc__content-space' : 'right'}`}
30+
>
31+
{docLink && (
32+
<button className="cta flex h-36" type="submit" onClick={noop}>
33+
<a className="" href={docLink} target="_blank" rel="noreferrer">
34+
{BUTTON_TEXT.VIEW_DOCUMENTATION}
35+
</a>
36+
</button>
37+
)}
38+
<button className="cta flex h-36" type="submit" onClick={closeModal}>
39+
{closeModalText}
40+
</button>
41+
</div>
42+
)
43+
44+
return (
45+
<VisibleModal className="">
46+
<div className="feature-description modal__body w-600 mt-40 flex column dc__gap-16 p-0 fs-13">
47+
{renderDescriptionBody()}
48+
{renderFooter()}
49+
</div>
50+
</VisibleModal>
51+
)
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { useState } from 'react'
2+
import { DescriptorProps } from './types'
3+
import { ReactComponent as ICHelpOutline } from '../../../Assets/Icon/ic-help-outline.svg'
4+
import { BreadCrumb } from '../../../Common'
5+
import { FeatureDescriptionModal } from './FeatureDescriptionModal'
6+
7+
const FeatureTitleWithInfo = ({
8+
additionalContainerClasses,
9+
breadCrumbs,
10+
children,
11+
iconClassName,
12+
title,
13+
image,
14+
renderDescriptionContent,
15+
closeModalText,
16+
docLink,
17+
}: DescriptorProps) => {
18+
const [showFeatureDescriptionModal, setShowFeatureDescriptionModal] = useState(false)
19+
const onClickInfoIcon = () => {
20+
setShowFeatureDescriptionModal(true)
21+
}
22+
23+
const closeModal = () => {
24+
setShowFeatureDescriptionModal(false)
25+
}
26+
return (
27+
<>
28+
<div
29+
className={`feature-description flexbox dc__content-space dc__align-items-center w-100 ${additionalContainerClasses ?? ''}`}
30+
>
31+
<div className="flexbox dc__align-items-center dc__gap-4">
32+
<BreadCrumb breadcrumbs={breadCrumbs} />
33+
<ICHelpOutline className={`${iconClassName} icon-dim-20 cursor`} onClick={onClickInfoIcon} />
34+
</div>
35+
36+
{children}
37+
</div>
38+
{showFeatureDescriptionModal && (
39+
<FeatureDescriptionModal
40+
image={image}
41+
title={title}
42+
renderDescriptionContent={renderDescriptionContent}
43+
closeModalText={closeModalText}
44+
docLink={docLink}
45+
closeModal={closeModal}
46+
/>
47+
)}
48+
</>
49+
)
50+
}
51+
52+
export default FeatureTitleWithInfo
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export enum BUTTON_TEXT {
2+
GOT_IT = 'Got it',
3+
VIEW_DOCUMENTATION = 'View Documentation',
4+
}
5+
6+
export enum IMAGE_VARIANT {
7+
SMALL = 'small',
8+
LARGE = 'large',
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.feature-description{
2+
.large {
3+
width: 560px;
4+
max-height: 450px;
5+
}
6+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './FeatureDescriptionModal'
2+
export { default as FeatureTitleWithInfo } from './FeatureTitleWithInfo'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Breadcrumb } from '../../../Common/BreadCrumb/Types'
2+
import { IMAGE_VARIANT } from './constant'
3+
4+
export interface FeatureDescriptionModalProps {
5+
image
6+
title: string
7+
renderDescriptionContent?: () => JSX.Element
8+
closeModalText?: string
9+
docLink?: string
10+
closeModal: () => void
11+
imageVariant?: IMAGE_VARIANT
12+
}
13+
14+
export interface DescriptorProps extends FeatureDescriptionModalProps {
15+
breadCrumbs: Breadcrumb[]
16+
additionalContainerClasses?: string
17+
iconClassName?: string
18+
children?: React.ReactNode
19+
}

src/Shared/Components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ export * from './Header'
1717
export * from './AnnouncementBanner'
1818
export * from './ButtonWithLoader'
1919
export * from './ButtonWithSelector'
20+
export * from './FeatureDescription'

0 commit comments

Comments
 (0)