Skip to content

Commit be206cd

Browse files
committed
chore: add comments
1 parent 07a0e41 commit be206cd

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

src/Shared/Services/ToastManager/ToastContent.tsx

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

src/Shared/Services/ToastManager/toastManager.service.tsx

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,65 @@ import { TOAST_BASE_CONFIG, TOAST_VARIANT_TO_CONFIG_MAP } from './constants'
55
import { ToastContent } from './ToastContent'
66
import './toastManager.scss'
77

8+
/**
9+
* Service for handling toast across the application
10+
*
11+
* Note: The application needs to have `ToastManagerContainer` at the root
12+
* level for the toast to work
13+
*
14+
* @example Default Usage
15+
* ```ts
16+
* ToastManager.showToast({
17+
* description: 'Lorem ipsum'
18+
* })
19+
* ```
20+
*
21+
* @example Custom Title
22+
* ```ts
23+
* ToastManager.showToast({
24+
* description: 'Lorem ipsum',
25+
* title: 'Toast title'
26+
* })
27+
* ```
28+
*
29+
* @example With Button
30+
* ```ts
31+
* ToastManager.showToast({
32+
* description: 'Lorem ipsum',
33+
* buttonProps: {
34+
* dataTestId: 'toast-btn',
35+
* text: 'Reload',
36+
* startIcon: <ICArrowClockwise />
37+
* }
38+
* })
39+
* ```
40+
*
41+
* @example Auto close disabled
42+
* ```ts
43+
* ToastManager.showToast({
44+
* description: 'Lorem ipsum',
45+
* toastOptions: {
46+
* autoClose: false,
47+
* },
48+
* })
49+
* ```
50+
*
51+
* @example Custom progress bar color
52+
* ```ts
53+
* ToastManager.showToast({
54+
* description: 'Lorem ipsum',
55+
* progressBarBg: 'var(--N700)',
56+
* })
57+
* ```
58+
*
59+
* @example Custom icon
60+
* ```ts
61+
* ToastManager.showToast({
62+
* description: 'Lorem ipsum',
63+
* icon: <ICCube />,
64+
* })
65+
* ```
66+
*/
867
class ToastManager {
968
// eslint-disable-next-line no-use-before-define
1069
static #instance: ToastManager

0 commit comments

Comments
 (0)