1
- import { makeStyles } from "@mui/styles" ;
2
- import { useCallback , useState , FC } from "react" ;
1
+ import { type FC , useCallback , useState } from "react" ;
3
2
import { useCustomEvent } from "hooks/events" ;
4
- import { CustomEventListener } from "utils/events" ;
3
+ import type { CustomEventListener } from "utils/events" ;
5
4
import { EnterpriseSnackbar } from "./EnterpriseSnackbar" ;
6
5
import { ErrorIcon } from "../Icons/ErrorIcon" ;
7
6
import { Typography } from "../Typography/Typography" ;
8
7
import {
9
- AdditionalMessage ,
8
+ type AdditionalMessage ,
10
9
isNotificationList ,
11
10
isNotificationText ,
12
11
isNotificationTextPrefixed ,
13
12
MsgType ,
14
- NotificationMsg ,
13
+ type NotificationMsg ,
15
14
SnackbarEventType ,
16
15
} from "./utils" ;
16
+ import { type Interpolation , type Theme } from "@emotion/react" ;
17
17
18
18
const variantFromMsgType = ( type : MsgType ) => {
19
19
if ( type === MsgType . Error ) {
@@ -26,7 +26,6 @@ const variantFromMsgType = (type: MsgType) => {
26
26
} ;
27
27
28
28
export const GlobalSnackbar : FC = ( ) => {
29
- const styles = useStyles ( ) ;
30
29
const [ open , setOpen ] = useState < boolean > ( false ) ;
31
30
const [ notification , setNotification ] = useState < NotificationMsg > ( ) ;
32
31
@@ -47,7 +46,7 @@ export const GlobalSnackbar: FC = () => {
47
46
key = { idx }
48
47
gutterBottom
49
48
variant = "body2"
50
- className = { styles . messageSubtitle }
49
+ css = { styles . messageSubtitle }
51
50
>
52
51
{ msg }
53
52
</ Typography >
@@ -58,17 +57,17 @@ export const GlobalSnackbar: FC = () => {
58
57
key = { idx }
59
58
gutterBottom
60
59
variant = "body2"
61
- className = { styles . messageSubtitle }
60
+ css = { styles . messageSubtitle }
62
61
>
63
62
< strong > { msg . prefix } :</ strong > { msg . text }
64
63
</ Typography >
65
64
) ;
66
65
} else if ( isNotificationList ( msg ) ) {
67
66
return (
68
- < ul className = { styles . list } key = { idx } >
67
+ < ul css = { styles . list } key = { idx } >
69
68
{ msg . map ( ( item , idx ) => (
70
69
< li key = { idx } >
71
- < Typography variant = "body2" className = { styles . messageSubtitle } >
70
+ < Typography variant = "body2" css = { styles . messageSubtitle } >
72
71
{ item }
73
72
</ Typography >
74
73
</ li >
@@ -89,12 +88,12 @@ export const GlobalSnackbar: FC = () => {
89
88
open = { open }
90
89
variant = { variantFromMsgType ( notification . msgType ) }
91
90
message = {
92
- < div className = { styles . messageWrapper } >
91
+ < div css = { styles . messageWrapper } >
93
92
{ notification . msgType === MsgType . Error && (
94
- < ErrorIcon className = { styles . errorIcon } />
93
+ < ErrorIcon css = { styles . errorIcon } />
95
94
) }
96
- < div className = { styles . message } >
97
- < Typography variant = "body1" className = { styles . messageTitle } >
95
+ < div css = { styles . message } >
96
+ < Typography variant = "body1" css = { styles . messageTitle } >
98
97
{ notification . msg }
99
98
</ Typography >
100
99
{ notification . additionalMsgs &&
@@ -112,7 +111,7 @@ export const GlobalSnackbar: FC = () => {
112
111
) ;
113
112
} ;
114
113
115
- const useStyles = makeStyles ( ( theme ) => ( {
114
+ const styles = {
116
115
list : {
117
116
paddingLeft : 0 ,
118
117
} ,
@@ -126,11 +125,11 @@ const useStyles = makeStyles((theme) => ({
126
125
fontSize : 14 ,
127
126
fontWeight : 600 ,
128
127
} ,
129
- messageSubtitle : {
128
+ messageSubtitle : ( theme ) => ( {
130
129
marginTop : theme . spacing ( 1.5 ) ,
131
- } ,
132
- errorIcon : {
130
+ } ) ,
131
+ errorIcon : ( theme ) => ( {
133
132
color : theme . palette . error . contrastText ,
134
133
marginRight : theme . spacing ( 2 ) ,
135
- } ,
136
- } ) ) ;
134
+ } ) ,
135
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments