Skip to content

Commit d2e9ab1

Browse files
committed
css fixes for feature description
1 parent 520511b commit d2e9ab1

File tree

8 files changed

+69
-14
lines changed

8 files changed

+69
-14
lines changed

src/Common/BreadCrumb/BreadcrumbStore.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import React, { createContext, useState } from 'react'
2+
import { BreadcrumbTextProps } from './Types'
23

34
const initialState = {
45
alias: {},
56
}
67

8+
export const BreadcrumbText = ({ heading, isActive }: BreadcrumbTextProps) => (
9+
<h2 className={`m-0 fs-16 fw-6 lh-32 ${isActive ? 'cn-9' : 'cb-5'}`}>{heading}</h2>
10+
)
11+
712
const Store = ({ children }) => {
813
const [state, setState] = useState(initialState)
914
return <BreadcrumbContext.Provider value={{ state, setState }}>{children}</BreadcrumbContext.Provider>

src/Common/BreadCrumb/Types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,8 @@ export interface Breadcrumbs {
2727
}
2828

2929
export type UseBreadcrumbOptionalProps = UseBreadcrumbProps | null
30+
31+
export interface BreadcrumbTextProps {
32+
heading: string
33+
isActive?: boolean
34+
}

src/Common/Types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ export interface ErrorScreenNotAuthorizedProps {
159159
export enum ImageType {
160160
Large = 'large',
161161
Medium = 'medium',
162+
SMALL = 'small',
162163
}
163164

164165
export interface InfoColourBarType {

src/Common/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export * from './Modals/OpaqueModal'
1414
export * from './Modals/VisibleModal'
1515
export * from './Modals/VisibleModal2'
1616
export { BreadCrumb, useBreadcrumb } from './BreadCrumb/BreadCrumb'
17-
export { default as BreadcrumbStore } from './BreadCrumb/BreadcrumbStore'
17+
export { default as BreadcrumbStore, BreadcrumbText } from './BreadCrumb/BreadcrumbStore'
1818
export { default as RadioGroup } from './RadioGroup'
1919
export { default as RadioGroupItem } from './RadioGroupItem'
2020
export { default as PopupMenu } from './PopupMenu'

src/Shared/Components/FeatureDescription/FeatureDescriptionModal.tsx

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { VisibleModal } from '../../../Common'
2-
import { BUTTON_TEXT, IMAGE_VARIANT } from './constant'
2+
import { BUTTON_TEXT } from './constant'
33
import { FeatureDescriptionModalProps } from './types'
44
import './featureDescription.scss'
55
import { ReactComponent as ArrowOutSquare } from '../../../Assets/Icon/ic-arrow-square-out.svg'
6+
import { getImageSize } from './utils'
67

78
export const FeatureDescriptionModal = ({
89
image,
@@ -12,18 +13,47 @@ export const FeatureDescriptionModal = ({
1213
docLink = '',
1314
closeModal,
1415
imageVariant,
16+
SVGImage,
17+
imageStyles = {},
1518
}: FeatureDescriptionModalProps) => {
19+
const renderImage = () => {
20+
if (!image && !SVGImage) {
21+
return null
22+
}
23+
if (image) {
24+
return (
25+
<div className="} dc__overflow-auto">
26+
<img
27+
src={image}
28+
style={{
29+
...imageStyles,
30+
width: `${getImageSize(imageVariant).width}`,
31+
height: `${getImageSize(imageVariant).height}`,
32+
}}
33+
className="image-class-name mt-16 mb-12"
34+
alt="feature-description"
35+
/>
36+
image
37+
</div>
38+
)
39+
}
40+
return (
41+
<div className="flexbox dc__align-center dc__justify-center mt-16 mb-12">
42+
<SVGImage
43+
style={{
44+
...imageStyles,
45+
width: `${getImageSize(imageVariant).width}`,
46+
height: `${getImageSize(imageVariant).height}`,
47+
}}
48+
/>
49+
</div>
50+
)
51+
}
1652
const renderDescriptionBody = () => (
1753
<div className="pl-20 pr-20 pt-16 pb-16 dc__gap-16">
1854
<div className="flex left w-100 fs-16 fw-6">{title}</div>
19-
<div className={`${imageVariant === IMAGE_VARIANT.SMALL ? 'mxh-350' : 'mxh-450'} dc__overflow-auto`}>
20-
<img
21-
src={image}
22-
className={`${imageVariant === IMAGE_VARIANT.SMALL ? 'small' : 'large'} mt-16 mb-12`}
23-
alt="feature-description"
24-
/>
25-
{typeof renderDescriptionContent === 'function' && renderDescriptionContent()}
26-
</div>
55+
{renderImage()}
56+
{typeof renderDescriptionContent === 'function' && renderDescriptionContent()}
2757
</div>
2858
)
2959

@@ -49,7 +79,7 @@ export const FeatureDescriptionModal = ({
4979
)
5080

5181
return (
52-
<VisibleModal className="">
82+
<VisibleModal className="" close={closeModal}>
5383
<div className="feature-description modal__body w-600 mt-40 flex column p-0 fs-13 dc__overflow-hidden">
5484
{renderDescriptionBody()}
5585
{renderFooter()}

src/Shared/Components/FeatureDescription/FeatureTitleWithInfo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const FeatureTitleWithInfo = ({
1414
renderDescriptionContent,
1515
closeModalText,
1616
docLink,
17+
SVGImage,
1718
}: DescriptorProps) => {
1819
const [showFeatureDescriptionModal, setShowFeatureDescriptionModal] = useState(false)
1920
const onClickInfoIcon = () => {
@@ -43,6 +44,7 @@ const FeatureTitleWithInfo = ({
4344
closeModalText={closeModalText}
4445
docLink={docLink}
4546
closeModal={closeModal}
47+
SVGImage={SVGImage}
4648
/>
4749
)}
4850
</>

src/Shared/Components/FeatureDescription/types.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
import { ImageType } from '../../../Common'
12
import { Breadcrumb } from '../../../Common/BreadCrumb/Types'
2-
import { IMAGE_VARIANT } from './constant'
33

44
export interface FeatureDescriptionModalProps {
5-
image
5+
image?
66
title: string
77
renderDescriptionContent?: () => JSX.Element
88
closeModalText?: string
99
docLink?: string
1010
closeModal?: () => void
11-
imageVariant?: IMAGE_VARIANT
11+
imageVariant?: ImageType
12+
SVGImage?: React.FunctionComponent<React.SVGProps<SVGSVGElement>>
13+
imageStyles?: React.CSSProperties
1214
}
1315

1416
export interface DescriptorProps extends FeatureDescriptionModalProps {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ImageType } from '../../../Common'
2+
3+
export const getImageSize = (imageType: ImageType) => {
4+
switch (imageType) {
5+
case ImageType.SMALL:
6+
return { width: '100%', height: '200px' }
7+
default:
8+
return { width: '100%', height: '250px' }
9+
}
10+
}

0 commit comments

Comments
 (0)