1
+ import { useTheme } from "@emotion/react" ;
1
2
import Paper from "@mui/material/Paper" ;
2
- import { makeStyles } from "@mui/styles" ;
3
- import { HTMLProps , ReactNode , FC , PropsWithChildren } from "react" ;
4
- import { combineClasses } from "utils/combineClasses" ;
3
+ import {
4
+ type HTMLProps ,
5
+ type ReactNode ,
6
+ type FC ,
7
+ type PropsWithChildren ,
8
+ } from "react" ;
5
9
6
10
export interface ChartSectionProps {
7
11
/**
@@ -18,44 +22,46 @@ export const ChartSection: FC<PropsWithChildren<ChartSectionProps>> = ({
18
22
contentsProps,
19
23
title,
20
24
} ) => {
21
- const styles = useStyles ( ) ;
25
+ const theme = useTheme ( ) ;
22
26
23
27
return (
24
- < Paper className = { styles . root } elevation = { 0 } >
28
+ < Paper
29
+ css = { {
30
+ border : `1px solid ${ theme . palette . divider } ` ,
31
+ borderRadius : theme . shape . borderRadius ,
32
+ } }
33
+ elevation = { 0 }
34
+ >
25
35
{ title && (
26
- < div className = { styles . header } >
27
- < h6 className = { styles . title } > { title } </ h6 >
36
+ < div
37
+ css = { {
38
+ alignItems : "center" ,
39
+ display : "flex" ,
40
+ justifyContent : "space-between" ,
41
+ padding : theme . spacing ( 1.5 , 2 ) ,
42
+ } }
43
+ >
44
+ < h6
45
+ css = { {
46
+ margin : 0 ,
47
+ fontSize : 14 ,
48
+ fontWeight : 600 ,
49
+ } }
50
+ >
51
+ { title }
52
+ </ h6 >
28
53
{ action && < div > { action } </ div > }
29
54
</ div >
30
55
) }
31
56
32
57
< div
33
58
{ ...contentsProps }
34
- className = { combineClasses ( [ styles . contents , contentsProps ?. className ] ) }
59
+ css = { {
60
+ margin : theme . spacing ( 2 ) ,
61
+ } }
35
62
>
36
63
{ children }
37
64
</ div >
38
65
</ Paper >
39
66
) ;
40
67
} ;
41
-
42
- const useStyles = makeStyles ( ( theme ) => ( {
43
- root : {
44
- border : `1px solid ${ theme . palette . divider } ` ,
45
- borderRadius : theme . shape . borderRadius ,
46
- } ,
47
- contents : {
48
- margin : theme . spacing ( 2 ) ,
49
- } ,
50
- header : {
51
- alignItems : "center" ,
52
- display : "flex" ,
53
- justifyContent : "space-between" ,
54
- padding : theme . spacing ( 1.5 , 2 ) ,
55
- } ,
56
- title : {
57
- margin : 0 ,
58
- fontSize : 14 ,
59
- fontWeight : 600 ,
60
- } ,
61
- } ) ) ;
0 commit comments