1
- import { makeStyles } from "@mui/styles " ;
2
- import { TemplateExample } from "api/typesGenerated" ;
3
- import { FC } from "react" ;
1
+ import { type Interpolation , type Theme } from "@emotion/react " ;
2
+ import type { TemplateExample } from "api/typesGenerated" ;
3
+ import { type FC } from "react" ;
4
4
import { Link } from "react-router-dom" ;
5
- import { combineClasses } from "utils/combineClasses" ;
6
5
7
6
export interface TemplateExampleCardProps {
8
7
example : TemplateExample ;
@@ -13,29 +12,26 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
13
12
example,
14
13
className,
15
14
} ) => {
16
- const styles = useStyles ( ) ;
17
-
18
15
return (
19
16
< Link
20
17
to = { `/starter-templates/${ example . id } ` }
21
- className = { combineClasses ( [ styles . template , className ] ) }
18
+ css = { styles . template }
19
+ className = { className }
22
20
key = { example . id }
23
21
>
24
- < div className = { styles . templateIcon } >
22
+ < div css = { styles . templateIcon } >
25
23
< img src = { example . icon } alt = "" />
26
24
</ div >
27
- < div className = { styles . templateInfo } >
28
- < span className = { styles . templateName } > { example . name } </ span >
29
- < span className = { styles . templateDescription } >
30
- { example . description }
31
- </ span >
25
+ < div css = { styles . templateInfo } >
26
+ < span css = { styles . templateName } > { example . name } </ span >
27
+ < span css = { styles . templateDescription } > { example . description } </ span >
32
28
</ div >
33
29
</ Link >
34
30
) ;
35
31
} ;
36
32
37
- const useStyles = makeStyles ( ( theme ) => ( {
38
- template : {
33
+ const styles = {
34
+ template : ( theme ) => ( {
39
35
border : `1px solid ${ theme . palette . divider } ` ,
40
36
borderRadius : theme . shape . borderRadius ,
41
37
background : theme . palette . background . paper ,
@@ -49,9 +45,9 @@ const useStyles = makeStyles((theme) => ({
49
45
"&:hover" : {
50
46
backgroundColor : theme . palette . background . paperLight ,
51
47
} ,
52
- } ,
48
+ } ) ,
53
49
54
- templateIcon : {
50
+ templateIcon : ( theme ) => ( {
55
51
width : theme . spacing ( 12 ) ,
56
52
height : theme . spacing ( 12 ) ,
57
53
display : "flex" ,
@@ -62,29 +58,29 @@ const useStyles = makeStyles((theme) => ({
62
58
"& img" : {
63
59
height : theme . spacing ( 4 ) ,
64
60
} ,
65
- } ,
61
+ } ) ,
66
62
67
- templateInfo : {
63
+ templateInfo : ( theme ) => ( {
68
64
padding : theme . spacing ( 2 , 2 , 2 , 0 ) ,
69
65
display : "flex" ,
70
66
flexDirection : "column" ,
71
67
overflow : "hidden" ,
72
- } ,
68
+ } ) ,
73
69
74
- templateName : {
70
+ templateName : ( theme ) => ( {
75
71
fontSize : theme . spacing ( 2 ) ,
76
72
textOverflow : "ellipsis" ,
77
73
width : "100%" ,
78
74
overflow : "hidden" ,
79
75
whiteSpace : "nowrap" ,
80
- } ,
76
+ } ) ,
81
77
82
- templateDescription : {
78
+ templateDescription : ( theme ) => ( {
83
79
fontSize : theme . spacing ( 1.75 ) ,
84
80
color : theme . palette . text . secondary ,
85
81
textOverflow : "ellipsis" ,
86
82
width : "100%" ,
87
83
overflow : "hidden" ,
88
84
whiteSpace : "nowrap" ,
89
- } ,
90
- } ) ) ;
85
+ } ) ,
86
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments