@@ -19,7 +19,7 @@ interface ToastComponentProps extends ToastProps {
19
19
}
20
20
21
21
const Toast = ( props : ToastComponentProps ) => {
22
- const IconComponent = icons [ props . variant ] ;
22
+ const IconComponent = props . variant ? icons [ props . variant ] : Info ;
23
23
const [ isExiting , setIsExiting ] = useState < boolean > ( false ) ;
24
24
25
25
const delayDuration = props . delayDuration || 4000 ;
@@ -48,6 +48,7 @@ const Toast = (props: ToastComponentProps) => {
48
48
const ANIMATION_ENTER_MAP : Record < Position , string > = {
49
49
'top-left' : 't_slide-top' ,
50
50
'top-right' : 't_slide-top' ,
51
+ 'top-center' : 't_slide-top' ,
51
52
'bottom-left' : 't_slide-bottom' ,
52
53
'bottom-right' : 't_slide-bottom' ,
53
54
'bottom-center' : 't_slide-bottom' ,
@@ -56,6 +57,7 @@ const Toast = (props: ToastComponentProps) => {
56
57
const ANIMATION_EXIT_MAP : Record < Position , string > = {
57
58
'top-left' : 't_slide-left' ,
58
59
'top-right' : 't_slide-right' ,
60
+ 'top-center' : 't_slide-top-exit' ,
59
61
'bottom-left' : 't_slide-left' ,
60
62
'bottom-right' : 't_slide-right' ,
61
63
'bottom-center' : 't_slide-bottom-exit' ,
@@ -79,15 +81,16 @@ const Toast = (props: ToastComponentProps) => {
79
81
onMouseLeave = { handleMouseLeave }
80
82
>
81
83
< div className = "t_container" >
82
- { props . icon ? (
83
- props . icon
84
- ) : (
85
- < IconComponent
86
- width = { props . iconSize || 18 }
87
- height = { props . iconSize || 18 }
88
- fill = "currentColor"
89
- />
90
- ) }
84
+ { props . variant &&
85
+ ( props . icon ? (
86
+ < div className = "t_icon" > { props . icon } </ div >
87
+ ) : (
88
+ < IconComponent
89
+ width = { props . iconSize || 18 }
90
+ height = { props . iconSize || 18 }
91
+ className = "t_icon"
92
+ />
93
+ ) ) }
91
94
< div className = "t_content" >
92
95
< p > { props . text } </ p >
93
96
{ props . description && < p > { props . description } </ p > }
0 commit comments