1
+ import { type Interpolation , type Theme } from "@emotion/react" ;
1
2
import Collapse from "@mui/material/Collapse" ;
2
3
import Link from "@mui/material/Link" ;
3
- import makeStyles from "@mui/styles/makeStyles" ;
4
4
import { DropdownArrow } from "components/DropdownArrow/DropdownArrow" ;
5
5
import { type FC , type PropsWithChildren } from "react" ;
6
- import { combineClasses } from "utils/combineClasses" ;
7
6
8
7
export interface ExpanderProps {
9
8
expanded : boolean ;
@@ -15,29 +14,27 @@ export const Expander: FC<PropsWithChildren<ExpanderProps>> = ({
15
14
setExpanded,
16
15
children,
17
16
} ) => {
18
- const styles = useStyles ( ) ;
19
-
20
17
const toggleExpanded = ( ) => setExpanded ( ! expanded ) ;
21
18
22
19
return (
23
20
< >
24
21
{ ! expanded && (
25
- < Link onClick = { toggleExpanded } className = { styles . expandLink } >
26
- < span className = { styles . text } >
22
+ < Link onClick = { toggleExpanded } css = { styles . expandLink } >
23
+ < span css = { styles . text } >
27
24
Click here to learn more
28
25
< DropdownArrow margin = { false } />
29
26
</ span >
30
27
</ Link >
31
28
) }
32
29
< Collapse in = { expanded } >
33
- < div className = { styles . text } > { children } </ div >
30
+ < div css = { styles . text } > { children } </ div >
34
31
</ Collapse >
35
32
{ expanded && (
36
33
< Link
37
34
onClick = { toggleExpanded }
38
- className = { combineClasses ( [ styles . expandLink , styles . collapseLink ] ) }
35
+ css = { [ styles . expandLink , styles . collapseLink ] }
39
36
>
40
- < span className = { styles . text } >
37
+ < span css = { styles . text } >
41
38
Click here to hide
42
39
< DropdownArrow margin = { false } close />
43
40
</ span >
@@ -47,18 +44,18 @@ export const Expander: FC<PropsWithChildren<ExpanderProps>> = ({
47
44
) ;
48
45
} ;
49
46
50
- const useStyles = makeStyles ( ( theme ) => ( {
51
- expandLink : {
47
+ const styles = {
48
+ expandLink : ( theme ) => ( {
52
49
cursor : "pointer" ,
53
50
color : theme . palette . text . secondary ,
54
- } ,
55
- collapseLink : {
51
+ } ) ,
52
+ collapseLink : ( theme ) => ( {
56
53
marginTop : theme . spacing ( 2 ) ,
57
- } ,
58
- text : {
54
+ } ) ,
55
+ text : ( theme ) => ( {
59
56
display : "flex" ,
60
57
alignItems : "center" ,
61
58
color : theme . palette . text . secondary ,
62
59
fontSize : theme . typography . caption . fontSize ,
63
- } ,
64
- } ) ) ;
60
+ } ) ,
61
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments