@@ -3,7 +3,7 @@ import { Transition, Toast, Alert } from 'solid-headless'
3
3
import { AiOutlineCheckCircle } from 'solid-icons/ai'
4
4
import { FiAlertTriangle , FiAlertOctagon } from 'solid-icons/fi'
5
5
import { IoAlertCircleSharp } from 'solid-icons/io'
6
- import { createSignal , Component } from 'solid-js'
6
+ import { createSignal , Component , Show } from 'solid-js'
7
7
import CloseIcon from '@components/CloseIcon'
8
8
import { ENotificationType } from '@static/types/enums'
9
9
import { notifications , notificationsType } from '@store/ui/selectors'
@@ -14,16 +14,27 @@ interface ToastProps {
14
14
}
15
15
16
16
const NotificationIcon = ( ) => {
17
- switch ( notificationsType ( ) ) {
18
- case ENotificationType . SUCCESS :
19
- return < AiOutlineCheckCircle size = { 25 } color = "#68D391" />
20
- case ENotificationType . ERROR :
21
- return < FiAlertOctagon size = { 25 } color = "#F56565" />
22
- case ENotificationType . WARNING :
23
- return < FiAlertTriangle size = { 25 } color = "#F6E05E" />
24
- case ENotificationType . INFO :
25
- return < IoAlertCircleSharp size = { 25 } color = "#90CDF4" />
26
- }
17
+ return (
18
+ < div >
19
+ < Show when = { notificationsType ( ) === ENotificationType . SUCCESS } >
20
+ < AiOutlineCheckCircle size = { 25 } color = "#68D391" />
21
+ </ Show >
22
+ < Show when = { notificationsType ( ) === ENotificationType . ERROR } >
23
+ < FiAlertOctagon size = { 25 } color = "#F56565" />
24
+ </ Show >
25
+ < Show when = { notificationsType ( ) === ENotificationType . WARNING } >
26
+ < FiAlertTriangle size = { 25 } color = "#F6E05E" />
27
+ </ Show >
28
+ < Show when = { notificationsType ( ) === ENotificationType . INFO } >
29
+ < IoAlertCircleSharp size = { 25 } color = "#90CDF4" />
30
+ </ Show >
31
+ </ div >
32
+ )
33
+
34
+ /*
35
+
36
+
37
+ */
27
38
}
28
39
29
40
const CustomToast : Component < ToastProps > = ( props ) => {
@@ -48,7 +59,7 @@ const CustomToast: Component<ToastProps> = (props) => {
48
59
} } >
49
60
< Toast class = "flex justify-between items-center" >
50
61
< Alert class = "bg-slate-600 flex grow flex-row items-center justify-center text-xl text-bold text-gray-50 p-4" >
51
- { NotificationIcon ( ) }
62
+ < NotificationIcon />
52
63
< span class = "flex-1 text-sm font-semibold pl-1 pr-1 text-gray-50" >
53
64
{ props . message }
54
65
</ span >
0 commit comments