Skip to content

Commit 6fc2b99

Browse files
committed
feature. Versionup react-toastify
1 parent e7b138e commit 6fc2b99

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"lodash": "^4.17.21",
8484
"react-modal": "^3.16.1",
8585
"react-slick": "^0.29.0",
86-
"react-toastify": "^9.1.3",
86+
"react-toastify": "^11.0.3",
8787
"react-tooltip": "^5.21.1"
8888
},
8989
"repository": {

src/components/guide/badge/TBadge.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'react-toastify/dist/ReactToastify.css';
21
import {CSSProperties, useMemo} from 'react';
32
import {TBadgeProps} from '@/components';
43

src/components/guide/toast/TToast.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import 'react-toastify/dist/ReactToastify.css';
2-
import {Theme, toast, ToastContainer} from 'react-toastify';
3-
import {ToastPosition} from 'react-toastify/dist/types';
4-
import {TToastProps} from './TToast.interface';
1+
'use client';
2+
3+
import {Theme, toast, ToastContainer, ToastPosition} from 'react-toastify';
4+
5+
import {TToastProps} from '@/components';
56

67
function TToast({
78
theme = 'light' as Theme,
89
className = 'tks-toast-container',
910
autoClose = 5000,
1011
toastClassName = 'tks-toast',
11-
bodyClassName = 'tks-toast__body',
12-
progressClassName = 'tks-toast__progress',
1312
position = 'top-right' as ToastPosition,
1413
draggable = false,
1514
...restProps
@@ -20,10 +19,9 @@ function TToast({
2019
className,
2120
autoClose,
2221
toastClassName,
23-
bodyClassName,
24-
progressClassName,
2522
position,
2623
draggable,
24+
2725
...restProps,
2826
};
2927

@@ -32,5 +30,8 @@ function TToast({
3230
);
3331
}
3432

35-
export const notify = toast;
33+
const notify = toast;
34+
35+
export {notify, toast};
36+
3637
export default TToast;

src/styles/component/guide/toast/TToast.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
--toastify-color-progress-success: #{$t-primary-color};
99
--toastify-color-progress-warning: #{$t-primary-color};
1010
--toastify-color-progress-error: #{$t-primary-color};
11+
--toastify-color-progress-bgo: 0.15;
1112

1213
--toastify-toast-width: 320px;
1314

15+
1416
$t-toastify-progress-bar-height: 5px;
1517

1618
@at-root .tks-toast-container {
@@ -20,16 +22,22 @@
2022

2123
.Toastify__toast {
2224

23-
padding: $t-spacing-16 $t-spacing-10 calc($t-spacing-16 + $t-toastify-progress-bar-height) $t-spacing-16;
25+
padding-top: $t-spacing-16;
26+
padding-right: calc($t-spacing-16 + $t-spacing-20 + $t-spacing-10);
27+
padding-bottom: calc($t-spacing-16 + $t-toastify-progress-bar-height);
28+
padding-left: $t-spacing-16;
29+
30+
2431
border-radius: 4px;
2532
font-weight: normal;
33+
@include typo-element-3
2634
}
2735

28-
.Toastify__toast-body {
29-
margin: 0;
30-
padding: 0 $t-spacing-16 0 0;
3136

32-
@include typo-element-3
37+
.Toastify__close-button {
38+
padding-top: 10px;
39+
margin-left: $t-spacing-16;
40+
3341
}
3442

3543
}
@@ -61,6 +69,7 @@
6169

6270
.Toastify__progress-bar {
6371
height: $t-toastify-progress-bar-height;
72+
opacity: 1;
6473
}
6574

6675
}

stories/components/guide/toast/TToast.stories.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Meta, StoryObj} from '@storybook/react';
22
import React from 'react';
3-
import {ToastPosition} from 'react-toastify/dist/types';
3+
4+
import {ToastPosition} from 'react-toastify';
45
import TToast, {notify} from '@/components/guide/toast/TToast';
56
import TButton from '@/components/button/button/TButton';
67

@@ -56,10 +57,8 @@ export const Default: Story = {
5657
render: Template,
5758
args: {
5859
className: 'tks-toast-container',
59-
autoClose: 5000,
60+
autoClose: 10000,
6061
toastClassName: 'tks-toast',
61-
bodyClassName: 'tks-toast__body',
62-
progressClassName: 'tks-toast__progress',
6362
position: 'top-right' as ToastPosition,
6463
draggable: false,
6564
},

0 commit comments

Comments
 (0)