Skip to content

Commit 0819f5f

Browse files
committed
feat: add action button support to InfoColourBar component
1 parent 716a644 commit 0819f5f

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

src/Common/InfoColorBar/InfoColourbar.tsx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { Link } from 'react-router-dom'
1818
import { InfoColourBarType } from '../Types'
1919
import { Tooltip } from '@Common/Tooltip'
20+
import { Button } from '@Shared/Components'
2021
import './infoColourBar.scss'
2122

2223
const InfoColourBar = ({
@@ -82,15 +83,23 @@ const InfoColourBar = ({
8283

8384
const renderMessageWrapper = () => {
8485
if (textConfig) {
85-
const { heading, description } = textConfig
86+
const { heading, description, actionButtonConfig } = textConfig
8687

8788
return (
88-
<div className="flexbox-col">
89-
{heading && <h6 className="m-0 cn-9 fs-13 fw-6 lh-20 dc__truncate">{heading}</h6>}
89+
<div className="flexbox flex-grow-1 dc__content-space dc__align-start">
90+
<div className="flexbox-col">
91+
{heading && <h6 className="m-0 cn-9 fs-13 fw-6 lh-20 dc__truncate">{heading}</h6>}
9092

91-
<Tooltip content={description}>
92-
<p className="dc__truncate--clamp-3 m-0 cn-9 fs-13 fw-4 lh-20">{description}</p>
93-
</Tooltip>
93+
<Tooltip content={description}>
94+
<p className="dc__truncate--clamp-3 m-0 cn-9 fs-13 fw-4 lh-20">{description}</p>
95+
</Tooltip>
96+
</div>
97+
98+
{actionButtonConfig && (
99+
<Button
100+
{...actionButtonConfig}
101+
/>
102+
)}
94103
</div>
95104
)
96105
}

src/Common/Types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
Severity,
2626
PolicyBlockInfo,
2727
TargetPlatformItemDTO,
28+
ButtonProps,
2829
} from '../Shared'
2930
import {
3031
ACTION_STATE,
@@ -217,6 +218,7 @@ interface InfoColourBarTextConfigType {
217218
* If given would be shown below the heading (if given)
218219
*/
219220
description: string
221+
actionButtonConfig?: ButtonProps
220222
}
221223

222224
type InfoColourBarMessageProp = {

0 commit comments

Comments
 (0)