Skip to content

Commit 3934f0e

Browse files
committed
emotion: AvatarData
1 parent 949c010 commit 3934f0e

File tree

1 file changed

+34
-31
lines changed

1 file changed

+34
-31
lines changed

site/src/components/AvatarData/AvatarData.tsx

+34-31
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
import type { FC } from "react";
2+
import { useTheme } from "@emotion/react";
13
import { Avatar } from "components/Avatar/Avatar";
2-
import { FC } from "react";
34
import { Stack } from "components/Stack/Stack";
4-
import { makeStyles } from "@mui/styles";
55

66
export interface AvatarDataProps {
77
title: string | JSX.Element;
@@ -16,7 +16,7 @@ export const AvatarData: FC<AvatarDataProps> = ({
1616
src,
1717
avatar,
1818
}) => {
19-
const styles = useStyles();
19+
const theme = useTheme();
2020

2121
if (!avatar) {
2222
avatar = <Avatar src={src}>{title}</Avatar>;
@@ -27,38 +27,41 @@ export const AvatarData: FC<AvatarDataProps> = ({
2727
spacing={1.5}
2828
direction="row"
2929
alignItems="center"
30-
className={styles.root}
30+
css={{
31+
minHeight: theme.spacing(5), // Make it predictable for the skeleton
32+
width: "100%",
33+
lineHeight: "150%",
34+
}}
3135
>
3236
{avatar}
3337

34-
<Stack spacing={0} className={styles.info}>
35-
<span className={styles.title}>{title}</span>
36-
{subtitle && <span className={styles.subtitle}>{subtitle}</span>}
38+
<Stack
39+
spacing={0}
40+
css={{
41+
width: "100%",
42+
}}
43+
>
44+
<span
45+
css={{
46+
color: theme.palette.text.primary,
47+
fontWeight: 600,
48+
}}
49+
>
50+
{title}
51+
</span>
52+
{subtitle && (
53+
<span
54+
css={{
55+
fontSize: 12,
56+
color: theme.palette.text.secondary,
57+
lineHeight: "150%",
58+
maxWidth: 540,
59+
}}
60+
>
61+
{subtitle}
62+
</span>
63+
)}
3764
</Stack>
3865
</Stack>
3966
);
4067
};
41-
42-
const useStyles = makeStyles((theme) => ({
43-
root: {
44-
minHeight: theme.spacing(5), // Make it predictable for the skeleton
45-
width: "100%",
46-
lineHeight: "150%",
47-
},
48-
49-
info: {
50-
width: "100%",
51-
},
52-
53-
title: {
54-
color: theme.palette.text.primary,
55-
fontWeight: 600,
56-
},
57-
58-
subtitle: {
59-
fontSize: 12,
60-
color: theme.palette.text.secondary,
61-
lineHeight: "150%",
62-
maxWidth: 540,
63-
},
64-
}));

0 commit comments

Comments
 (0)