Skip to content

Commit e07bf78

Browse files
committed
emotion: TemplateExampleCard
1 parent 0ae7c89 commit e07bf78

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed
Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
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";
44
import { Link } from "react-router-dom";
5-
import { combineClasses } from "utils/combineClasses";
65

76
export interface TemplateExampleCardProps {
87
example: TemplateExample;
@@ -13,29 +12,26 @@ export const TemplateExampleCard: FC<TemplateExampleCardProps> = ({
1312
example,
1413
className,
1514
}) => {
16-
const styles = useStyles();
17-
1815
return (
1916
<Link
2017
to={`/starter-templates/${example.id}`}
21-
className={combineClasses([styles.template, className])}
18+
css={styles.template}
19+
className={className}
2220
key={example.id}
2321
>
24-
<div className={styles.templateIcon}>
22+
<div css={styles.templateIcon}>
2523
<img src={example.icon} alt="" />
2624
</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>
3228
</div>
3329
</Link>
3430
);
3531
};
3632

37-
const useStyles = makeStyles((theme) => ({
38-
template: {
33+
const styles = {
34+
template: (theme) => ({
3935
border: `1px solid ${theme.palette.divider}`,
4036
borderRadius: theme.shape.borderRadius,
4137
background: theme.palette.background.paper,
@@ -49,9 +45,9 @@ const useStyles = makeStyles((theme) => ({
4945
"&:hover": {
5046
backgroundColor: theme.palette.background.paperLight,
5147
},
52-
},
48+
}),
5349

54-
templateIcon: {
50+
templateIcon: (theme) => ({
5551
width: theme.spacing(12),
5652
height: theme.spacing(12),
5753
display: "flex",
@@ -62,29 +58,29 @@ const useStyles = makeStyles((theme) => ({
6258
"& img": {
6359
height: theme.spacing(4),
6460
},
65-
},
61+
}),
6662

67-
templateInfo: {
63+
templateInfo: (theme) => ({
6864
padding: theme.spacing(2, 2, 2, 0),
6965
display: "flex",
7066
flexDirection: "column",
7167
overflow: "hidden",
72-
},
68+
}),
7369

74-
templateName: {
70+
templateName: (theme) => ({
7571
fontSize: theme.spacing(2),
7672
textOverflow: "ellipsis",
7773
width: "100%",
7874
overflow: "hidden",
7975
whiteSpace: "nowrap",
80-
},
76+
}),
8177

82-
templateDescription: {
78+
templateDescription: (theme) => ({
8379
fontSize: theme.spacing(1.75),
8480
color: theme.palette.text.secondary,
8581
textOverflow: "ellipsis",
8682
width: "100%",
8783
overflow: "hidden",
8884
whiteSpace: "nowrap",
89-
},
90-
}));
85+
}),
86+
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)