Skip to content

Commit 825be6d

Browse files
committed
fix: replace close button with icon button
1 parent 48127ba commit 825be6d

File tree

5 files changed

+27
-11
lines changed

5 files changed

+27
-11
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.2.30-beta-5",
3+
"version": "0.2.30-beta-6",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Services/ToastManager/ToastContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const ToastContent = ({
77
description,
88
buttonProps,
99
}: Pick<ToastProps, 'title' | 'description' | 'buttonProps'>) => (
10-
<div className="flexbox-col dc__gap-8">
10+
<div className="flexbox-col dc__gap-8 custom-toast__content">
1111
<div className="flexbox-col dc__gap-4">
1212
<h3 className="m-0 fs-13 fw-6 lh-20 cn-0 dc__truncate">{title}</h3>
1313
<p className="fs-12 fw-4 lh-18 m-0 dc__truncate--clamp-6">{description}</p>

src/Shared/Services/ToastManager/constants.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { MouseEventHandler } from 'react'
21
import { ToastOptions, ToastContainerProps } from 'react-toastify'
32
import { ReactComponent as ICInfoFilled } from '@Icons/ic-info-filled.svg'
43
import { ReactComponent as ICSuccess } from '@Icons/ic-success.svg'
54
import { ReactComponent as ICError } from '@Icons/ic-error.svg'
65
import { ReactComponent as ICWarning } from '@Icons/ic-warning.svg'
76
import { ReactComponent as ICLocked } from '@Icons/ic-locked.svg'
87
import { ReactComponent as ICClose } from '@Icons/ic-close.svg'
8+
import { Button, ButtonStyleType, ButtonVariantType } from '@Shared/Components'
9+
import { ComponentSizeType } from '@Shared/constants'
910
import { ToastProps, ToastVariantType } from './types'
1011

1112
export const TOAST_BASE_CONFIG: ToastContainerProps = {
@@ -18,9 +19,14 @@ export const TOAST_BASE_CONFIG: ToastContainerProps = {
1819
toastClassName: 'custom-toast',
1920
bodyClassName: 'custom-toast__body',
2021
closeButton: ({ closeToast }) => (
21-
<ICClose
22-
className="icon-dim-24 p-4 flex dc__no-shrink fcn-0 cursor"
23-
onClick={closeToast as MouseEventHandler}
22+
<Button
23+
icon={<ICClose className="fcn-0" />}
24+
onClick={closeToast}
25+
dataTestId="close-toast"
26+
ariaLabel="Close toast"
27+
size={ComponentSizeType.xs}
28+
variant={ButtonVariantType.text}
29+
style={ButtonStyleType.neutral}
2430
/>
2531
),
2632
}

src/Shared/Services/ToastManager/toastManager.scss

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,29 @@
2525
align-items: flex-start;
2626
align-self: center;
2727

28-
> .Toastify__toast-icon {
28+
>.Toastify__toast-icon {
2929
margin: 0;
3030
width: auto;
3131
align-self: flex-start;
3232
}
33+
}
3334

35+
&__content {
3436
button {
3537
color: var(--N0);
3638

37-
&:hover, &:active {
39+
svg *[stroke^="#"] {
40+
stroke: var(--N0);
41+
}
42+
43+
svg *[fill^="#"] {
44+
fill: var(--N0);
45+
}
46+
47+
&:hover,
48+
&:active {
3849
color: var(--N0);
3950
}
4051
}
4152
}
42-
// TODO: fix the styling for progress bar
4353
}

0 commit comments

Comments
 (0)