1
- import { makeStyles } from "@mui/styles " ;
1
+ import { useTheme } from "@emotion/react " ;
2
2
import Typography from "@mui/material/Typography" ;
3
- import { FC , ReactNode , PropsWithChildren } from "react" ;
3
+ import { type FC , type ReactNode , type PropsWithChildren } from "react" ;
4
4
import { SectionAction } from "./SectionAction" ;
5
+ import { type Interpolation , type Theme } from "@emotion/react" ;
5
6
6
7
type SectionLayout = "fixed" | "fluid" ;
7
8
@@ -31,31 +32,30 @@ export const Section: SectionFC = ({
31
32
children,
32
33
layout = "fixed" ,
33
34
} ) => {
34
- const styles = useStyles ( { layout } ) ;
35
+ const theme = useTheme ( ) ;
36
+
35
37
return (
36
38
< section className = { className } id = { id } data-testid = { id } >
37
- < div className = { styles . inner } >
39
+ < div css = { { maxWidth : layout === "fluid" ? "100%" : 500 } } >
38
40
{ ( title || description ) && (
39
- < div className = { styles . header } >
41
+ < div css = { styles . header } >
40
42
< div >
41
43
{ title && (
42
44
< Typography variant = "h4" sx = { { fontSize : 24 } } >
43
45
{ title }
44
46
</ Typography >
45
47
) }
46
48
{ description && typeof description === "string" && (
47
- < Typography className = { styles . description } >
48
- { description }
49
- </ Typography >
49
+ < Typography css = { styles . description } > { description } </ Typography >
50
50
) }
51
51
{ description && typeof description !== "string" && (
52
- < div className = { styles . description } > { description } </ div >
52
+ < div css = { styles . description } > { description } </ div >
53
53
) }
54
54
</ div >
55
55
{ toolbar && < div > { toolbar } </ div > }
56
56
</ div >
57
57
) }
58
- { alert && < div className = { styles . alert } > { alert } </ div > }
58
+ { alert && < div css = { { marginBottom : theme . spacing ( 1 ) } } > { alert } </ div > }
59
59
{ children }
60
60
</ div >
61
61
</ section >
@@ -65,23 +65,17 @@ export const Section: SectionFC = ({
65
65
// Sub-components
66
66
Section . Action = SectionAction ;
67
67
68
- const useStyles = makeStyles ( ( theme ) => ( {
69
- inner : ( { layout } : { layout : SectionLayout } ) => ( {
70
- maxWidth : layout === "fluid" ? "100%" : 500 ,
71
- } ) ,
72
- alert : {
73
- marginBottom : theme . spacing ( 1 ) ,
74
- } ,
75
- header : {
68
+ const styles = {
69
+ header : ( theme ) => ( {
76
70
marginBottom : theme . spacing ( 3 ) ,
77
71
display : "flex" ,
78
72
flexDirection : "row" ,
79
73
justifyContent : "space-between" ,
80
- } ,
81
- description : {
74
+ } ) ,
75
+ description : ( theme ) => ( {
82
76
color : theme . palette . text . secondary ,
83
77
fontSize : 16 ,
84
78
marginTop : theme . spacing ( 0.5 ) ,
85
79
lineHeight : "140%" ,
86
- } ,
87
- } ) ) ;
80
+ } ) ,
81
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments