6
6
*/
7
7
8
8
import { useDispatch , useSelector } from 'react-redux' ;
9
- import { Box , Breadcrumbs , emphasize , Link , SxProps , Theme , Tooltip , Typography } from '@mui/material' ;
9
+ import { Box , Breadcrumbs , emphasize , Link , Tooltip , Typography } from '@mui/material' ;
10
10
import { FolderOpen as FolderOpenIcon } from '@mui/icons-material' ;
11
- import { ElementAttributes , mergeSx } from '@gridsuite/commons-ui' ;
11
+ import { type ElementAttributes , mergeSx , type MuiStyles } from '@gridsuite/commons-ui' ;
12
12
import { MouseEvent } from 'react' ;
13
13
import { setSelectedDirectory } from '../redux/actions' ;
14
14
import { AppState } from '../redux/types' ;
15
15
16
16
const styles = {
17
- link : ( theme : Theme ) => ( {
17
+ link : ( theme ) => ( {
18
18
display : 'inline-grid' ,
19
19
alignItems : 'center' ,
20
20
textAlign : 'center' ,
21
21
color : theme . link . color ,
22
22
23
- backgroundColor : theme . row . primary ,
23
+ backgroundColor : theme . row . primary as string ,
24
24
padding : theme . spacing ( 0.5 , 2 , 0.5 ) ,
25
25
borderRadius : theme . spacing ( 2 ) ,
26
26
27
27
'&:hover, &:focus' : {
28
- backgroundColor : theme . row . hover ,
28
+ backgroundColor : theme . row . hover as string ,
29
29
textDecoration : 'none' ,
30
30
} ,
31
31
'&:active' : {
32
32
backgroundColor : emphasize ( theme . row . hover as string , 0.15 ) ,
33
33
} ,
34
34
} ) ,
35
- directory : ( theme : Theme ) => ( {
35
+ directory : ( theme ) => ( {
36
36
display : 'inline-grid' ,
37
37
alignItems : 'center' ,
38
38
textAlign : 'center' ,
39
39
40
- backgroundColor : theme . row . hover ,
40
+ backgroundColor : theme . row . hover as string ,
41
41
padding : theme . spacing ( 0.5 , 2 , 0.5 ) ,
42
42
borderRadius : theme . spacing ( 2 ) ,
43
43
@@ -46,14 +46,14 @@ const styles = {
46
46
selectedLabel : {
47
47
fontWeight : 'bold' ,
48
48
} ,
49
- icon : ( theme : Theme ) => ( {
49
+ icon : ( theme ) => ( {
50
50
marginRight : theme . spacing ( 1 ) ,
51
51
width : theme . spacing ( 2.25 ) ,
52
52
height : theme . spacing ( 2.25 ) ,
53
53
position : 'relative' ,
54
54
top : theme . spacing ( 0.5 ) ,
55
55
} ) ,
56
- breadcrumbs : ( theme : Theme ) => ( {
56
+ breadcrumbs : ( theme ) => ( {
57
57
padding : theme . spacing ( 0.5 , 0 , 0.5 ) ,
58
58
marginLeft : theme . spacing ( 1 ) ,
59
59
} ) ,
@@ -62,7 +62,7 @@ const styles = {
62
62
whiteSpace : 'nowrap' ,
63
63
overflow : 'hidden' ,
64
64
} ,
65
- } ;
65
+ } as const satisfies MuiStyles ;
66
66
67
67
export default function DirectoryBreadcrumbs ( ) {
68
68
const dispatch = useDispatch ( ) ;
@@ -81,7 +81,7 @@ export default function DirectoryBreadcrumbs() {
81
81
if ( selectedDirectory !== null && currentPath !== null && currentPath . length > 1 ) {
82
82
return currentPath . slice ( 0 , currentPath . length - 1 ) . map ( ( dir , index ) => (
83
83
< Link
84
- sx = { styles . link as SxProps }
84
+ sx = { styles . link }
85
85
key = { dir . elementUuid }
86
86
href = "/"
87
87
onClick = { ( event : MouseEvent < HTMLElement > ) => handleSelect ( event , dir ) }
@@ -106,7 +106,7 @@ export default function DirectoryBreadcrumbs() {
106
106
if ( selectedDirectory !== null && currentPath !== null && currentPath . length > 0 ) {
107
107
return (
108
108
< Tooltip title = { currentPath [ currentPath . length - 1 ] . elementName } >
109
- < Box sx = { styles . directory as SxProps } >
109
+ < Box sx = { styles . directory } >
110
110
< Typography sx = { mergeSx ( styles . selectedLabel , styles . limitTextSize ) } color = "textPrimary" >
111
111
{ currentPath . length === 1 && < FolderOpenIcon sx = { styles . icon } /> }
112
112
{ currentPath [ currentPath . length - 1 ] . elementName }
0 commit comments