Skip to content

Commit 64775a2

Browse files
added custom width for toast
1 parent 57fc012 commit 64775a2

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

src/services/Vertex.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@
1717
import { toast } from 'react-toastify';
1818
import { requestAPI } from '../handler/Handler';
1919
import { SchedulerLoggingService, LOG_LEVEL } from './LoggingService';
20-
import { showToast, toastifyCustomStyle } from '../utils/Config';
20+
import {
21+
showToast,
22+
toastifyCustomStyle,
23+
toastifyCustomWidth
24+
} from '../utils/Config';
2125
import {
2226
ICreatePayload,
2327
IVertexScheduleList,
@@ -114,7 +118,9 @@ export class VertexServices {
114118
} else {
115119
toast.error(
116120
<ExpandToastMessage message={data.error} />,
117-
toastifyCustomStyle
121+
data.error.length > 500
122+
? toastifyCustomWidth
123+
: toastifyCustomStyle
118124
);
119125
}
120126
}

src/utils/Config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ export const toastifyCustomStyle: ToastOptions<Record<string, never>> = {
7676
position: toast.POSITION.BOTTOM_CENTER
7777
};
7878

79+
export const toastifyCustomWidth: ToastOptions<Record<string, never>> = {
80+
hideProgressBar: true,
81+
autoClose: 600000,
82+
theme: 'dark',
83+
position: toast.POSITION.BOTTOM_CENTER,
84+
style: {
85+
width: '150%'
86+
}
87+
};
88+
7989
export const handleDebounce = (func: any, delay: number) => {
8090
let timeoutId: any;
8191
return function (...args: any) {

0 commit comments

Comments
 (0)