44 */
55
66import React , { useEffect , useState } from 'react' ;
7- import { makeStyles , createStyles , Theme } from '@material-ui/core /styles' ;
8- import { Grid , Paper , Tabs , Tab , Typography , Link } from '@material-ui/core ' ;
7+ import { Theme , ThemeProvider , createTheme , styled } from '@mui/material /styles' ;
8+ import { Grid , Paper , Tabs , Tab , Typography , Link , Snackbar , Alert , SnackbarCloseReason } from '@mui/material ' ;
99import { observer } from 'mobx-react' ;
10- import { ThemeProvider } from '@material-ui/styles' ;
11- import { createTheme } from '@material-ui/core/styles' ;
12- import Snackbar from '@material-ui/core/Snackbar' ;
13- import Alert from '@material-ui/lab/Alert' ;
1410import 'normalize.css' ;
1511import '@fontsource/roboto' ;
1612import '@fontsource/source-code-pro' ;
@@ -40,18 +36,20 @@ const mainTheme = createTheme({
4036 contrastText : '#fff' ,
4137 } ,
4238 } ,
43- props : {
39+ components : {
4440 MuiLink : {
45- underline : 'hover' ,
41+ defaultProps : {
42+ underline : 'hover' ,
43+ } ,
4644 } ,
4745 MuiTableCell : {
48- padding : 'normal' ,
49- } ,
50- } ,
51- overrides : {
52- MuiTableCell : {
53- root : {
54- padding : '1px' ,
46+ defaultProps : {
47+ padding : 'normal' ,
48+ } ,
49+ styleOverrides : {
50+ root : {
51+ padding : '1px' ,
52+ } ,
5553 } ,
5654 } ,
5755 } ,
@@ -79,100 +77,58 @@ mainTheme.typography.body1 = {
7977 marginBlockEnd : '10px' ,
8078} ;
8179
82- const useStyles = makeStyles ( ( theme : Theme ) =>
83- createStyles ( {
84- '@global' : {
85- '.MuiFormHelperText-contained.Mui-error' : {
86- position : 'absolute' ,
87- marginLeft : '9px' ,
88- bottom : '-11px' ,
89- padding : '0 4px' ,
90- backgroundColor : theme . palette . common . white ,
91- } ,
92- '.MuiButton-contained' : {
93- boxShadow : 'none' ,
94- } ,
95- '.MuiGrid-item:has(> .MuiButton-root)' : {
96- display : 'flex' ,
97- alignItems : 'end' ,
98- } ,
99- '.MuiInputBase-root.Mui-disabled' : {
100- color : 'rgba(0, 0, 0, 0.6)' ,
101- cursor : 'default' ,
102- } ,
103- '.MuiInputBase-root' : {
104- marginBlockEnd : '0px' ,
105- } ,
106- '.MuiListSubheader-root' : {
107- lineHeight : '24px' ,
108- marginBlockStart : '10px' ,
109- } ,
110- '.MuiMenuItem-root' : {
111- fontSize : '0.9rem' ,
112- marginBlockEnd : '5px' ,
113- marginBlockStart : '5px' ,
114- } ,
115- } ,
116- root : {
117- flexGrow : 1 ,
118- } ,
119- header : {
120- marginBottom : theme . spacing ( 2 ) ,
121- } ,
122- body : {
123- height : '100%' ,
124- } ,
125- paper : {
126- marginTop : theme . spacing ( 2 ) ,
127- padding : theme . spacing ( 2 ) ,
128- height : '100%' ,
129- '&:first-child' : {
130- marginTop : 0 ,
131- } ,
132- } ,
133- tabs : {
134- borderBottomColor : '#acb2c0' ,
135- borderBottomStyle : 'solid' ,
136- borderBottomWidth : '1px' ,
137- minHeight : '28px' ,
138- "& [aria-selected='true']" : {
139- backgroundColor : 'rgba(0, 134, 191, 0.21)' ,
140- } ,
80+ const classes = {
81+ root : {
82+ flexGrow : 1 ,
83+ } ,
84+ header : {
85+ mb : 2 ,
86+ } ,
87+ body : {
88+ height : '100%' ,
89+ } ,
90+ paper : {
91+ mt : 2 ,
92+ p : 2 ,
93+ height : '100%' ,
94+ '&:first-of-type' : {
95+ mt : 0 ,
14196 } ,
142- tabIndicator : {
97+ } ,
98+ tabs : {
99+ borderBottomColor : '#acb2c0' ,
100+ borderBottomStyle : 'solid' ,
101+ borderBottomWidth : '1px' ,
102+ minHeight : '28px' ,
103+ "& [aria-selected='true']" : {
143104 backgroundColor : 'rgba(0, 134, 191, 0.21)' ,
144105 } ,
145- indicator : {
146- backgroundColor : '#00bbe1' ,
147- } ,
148- footer : {
149- fontSize : '10px' ,
150- fontStyle : 'italic ' ,
151- color : '#5b606f ' ,
152- flexDirection : 'row ' ,
153- justifyContent : 'center ' ,
154- margin : theme . spacing ( 2 ) ,
155- '& *:first-child' : {
156- paddingTop : '27px' ,
157- } ,
106+ } ,
107+ indicator : {
108+ backgroundColor : '#00bbe1' ,
109+ } ,
110+ footer : {
111+ fontSize : '10px ' ,
112+ fontStyle : 'italic ' ,
113+ color : '#5b606f ' ,
114+ flexDirection : 'row ' ,
115+ justifyContent : 'center' ,
116+ m : 2 ,
117+ '& *:first-of-type' : {
118+ paddingTop : '27px' ,
158119 } ,
159- link : {
120+ } ,
121+ link : {
122+ color : '#5b606f' ,
123+ fontWeight : 'bold' ,
124+ '&:hover' : {
160125 color : '#5b606f' ,
161- fontWeight : 'bold' ,
162- '&:hover' : {
163- color : '#5b606f' ,
164- } ,
165- } ,
166- code : {
167- fontFamily : 'courier, courier new, serif' ,
168126 } ,
169- workbench : {
170- [ theme . breakpoints . down ( 'sm' ) ] : {
171- marginTop : '30px' ,
172- } ,
173- } ,
174- } )
175- ) ;
127+ } ,
128+ workbench : {
129+ mt : { xs : '30px' , md : 0 } ,
130+ } ,
131+ } as const ;
176132
177133const openAPIDocs = ( event : React . MouseEvent < HTMLElement > ) => {
178134 event . preventDefault ( ) ;
@@ -193,7 +149,6 @@ const openSupportedPlatformsDocs = (event: React.MouseEvent<HTMLElement>) => {
193149} ;
194150
195151export const App = observer ( ( ) => {
196- const classes = useStyles ( ) ;
197152 const [ fdc3Available , setFdc3Available ] = useState ( false ) ;
198153 const [ openSnackbar , setOpenSnackbar ] = useState ( false ) ;
199154 const [ tabIndex , setTabIndex ] = useState ( 0 ) ;
@@ -204,13 +159,12 @@ export const App = observer(() => {
204159 setTabIndex ( newIndex ) ;
205160 } ;
206161
207- const handleClose = ( event ?: React . SyntheticEvent , reason ?: string ) => {
162+ const handleClose = ( event ?: React . SyntheticEvent | Event , reason ?: SnackbarCloseReason ) => {
208163 if ( reason === 'clickaway' ) {
209164 return ;
210165 }
211166
212167 setOpenSnackbar ( false ) ;
213- // Need to show close animation
214168 setTimeout ( ( ) => snackbarStore . clearSnackbarData ( ) , 500 ) ;
215169 } ;
216170
@@ -230,23 +184,23 @@ export const App = observer(() => {
230184
231185 return (
232186 < ThemeProvider theme = { mainTheme } >
233- < Grid className = { classes . root } container >
234- < Grid className = { classes . header } container item xs = { 12 } >
187+ < Grid sx = { classes . root } container >
188+ < Grid sx = { classes . header } container item xs = { 12 } >
235189 < Header fdc3Available = { fdc3Available } />
236190 </ Grid >
237191 { fdc3Available ? (
238- < Grid className = { classes . body } container spacing = { 2 } item xs = { 12 } style = { { marginLeft : '0px' } } >
192+ < Grid sx = { classes . body } container spacing = { 2 } item xs = { 12 } style = { { marginLeft : '0px' } } >
239193 < Grid item xs = { 12 } md = { 8 } style = { { flex : 1 } } >
240- < Paper className = { classes . paper } >
194+ < Paper sx = { classes . paper } >
241195 < Tabs
242196 value = { tabIndex }
243197 indicatorColor = "primary"
244198 onChange = { handleTabChange }
245199 variant = "scrollable"
246200 scrollButtons = "auto"
247- className = { classes . tabs }
248- classes = { {
249- indicator : classes . indicator ,
201+ sx = { {
202+ ... classes . tabs ,
203+ '& .MuiTabs- indicator' : classes . indicator ,
250204 } }
251205 >
252206 < Tab label = "Contexts" />
@@ -269,16 +223,16 @@ export const App = observer(() => {
269223 </ Paper >
270224 </ Grid >
271225
272- < Grid item xs = { 12 } md = { 4 } className = { classes . workbench } >
273- < Paper className = { classes . paper } >
226+ < Grid item xs = { 12 } md = { 4 } sx = { classes . workbench } >
227+ < Paper sx = { classes . paper } >
274228 < Workbench />
275229 </ Paper >
276230 </ Grid >
277231 </ Grid >
278232 ) : (
279- < Grid className = { classes . body } container spacing = { 2 } item xs = { 12 } style = { { marginLeft : '0px' } } >
233+ < Grid sx = { classes . body } container spacing = { 2 } item xs = { 12 } style = { { marginLeft : '0px' } } >
280234 < Grid container direction = "column" justifyContent = "center" alignItems = "center" spacing = { 2 } item xs = { 12 } >
281- < Paper className = { classes . paper } >
235+ < Paper sx = { classes . paper } >
282236 < Typography variant = "h4" > FDC3 API not detected!</ Typography >
283237 < Typography variant = "body1" > An FDC3 desktop agent implementation was not found.</ Typography >
284238 < Typography variant = "body1" >
@@ -290,15 +244,15 @@ export const App = observer(() => {
290244 < Typography variant = "body1" >
291245 See the FDC3 standard documentation for details on{ ' ' }
292246 < Link
293- className = { classes . link }
247+ sx = { classes . link }
294248 href = "https://fdc3.finos.org/docs/supported-platforms"
295249 onClick = { openSupportedPlatformsDocs }
296250 >
297251 supported platforms
298252 </ Link > { ' ' }
299253 and{ ' ' }
300254 < Link
301- className = { classes . link }
255+ sx = { classes . link }
302256 href = "https://fdc3.finos.org/docs/api/spec#api-access"
303257 onClick = { openSpecAccessDocs }
304258 >
@@ -311,14 +265,14 @@ export const App = observer(() => {
311265 </ Grid >
312266 ) }
313267
314- < Grid container item xs = { 12 } className = { classes . footer } >
268+ < Grid container item xs = { 12 } sx = { classes . footer } >
315269 < Typography variant = "body1" >
316270 Learn more about the{ ' ' }
317- < Link className = { classes . link } href = "https://fdc3.finos.org/docs/api/overview" onClick = { openAPIDocs } >
271+ < Link sx = { classes . link } href = "https://fdc3.finos.org/docs/api/overview" onClick = { openAPIDocs } >
318272 FDC3 Standard and APIs
319273 </ Link > { ' ' }
320274 | Proud member of the{ ' ' }
321- < Link className = { classes . link } href = "https://www.finos.org/" >
275+ < Link sx = { classes . link } href = "https://www.finos.org/" >
322276 Fintech Open Source Foundation
323277 </ Link > { ' ' }
324278 | Copyright © 2021-2023 Finsemble, inc. & Contributors to the FDC3 standards project
@@ -327,7 +281,7 @@ export const App = observer(() => {
327281 </ Grid >
328282
329283 < Snackbar key = { snackbarStore . snackbarData ?. id } open = { openSnackbar } autoHideDuration = { 4000 } onClose = { handleClose } >
330- < Alert elevation = { 6 } variant = "filled" onClose = { handleClose } severity = { snackbarStore . snackbarData ?. type } >
284+ < Alert elevation = { 6 } variant = "filled" onClose = { ( ) => handleClose ( ) } severity = { snackbarStore . snackbarData ?. type } >
331285 { snackbarStore . snackbarData ?. message }
332286 </ Alert >
333287 </ Snackbar >
0 commit comments