Skip to content

Commit a7343f0

Browse files
committed
emotion: LastUsed
1 parent b0cdf3f commit a7343f0

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed
Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
1-
import { makeStyles, useTheme } from "@mui/styles";
2-
import { FC } from "react";
1+
import { type FC } from "react";
32
import dayjs from "dayjs";
43
import relativeTime from "dayjs/plugin/relativeTime";
5-
import { colors } from "theme/colors";
4+
import { useTheme } from "@emotion/react";
65
import { Stack } from "components/Stack/Stack";
7-
import { Theme } from "@mui/material/styles";
6+
import { colors } from "theme/colors";
87

98
dayjs.extend(relativeTime);
109

11-
type CircleProps = { color: string; variant?: "solid" | "outlined" };
10+
type CircleProps = {
11+
color: string;
12+
variant?: "solid" | "outlined";
13+
};
1214

1315
const Circle: FC<CircleProps> = ({ color, variant = "solid" }) => {
14-
const styles = useCircleStyles({ color, variant });
15-
return <div className={styles.root} />;
16-
};
16+
const theme = useTheme();
1717

18-
const useCircleStyles = makeStyles((theme) => ({
19-
root: {
20-
width: theme.spacing(1),
21-
height: theme.spacing(1),
22-
backgroundColor: (props: CircleProps) =>
23-
props.variant === "solid" ? props.color : undefined,
24-
border: (props: CircleProps) =>
25-
props.variant === "outlined" ? `1px solid ${props.color}` : undefined,
26-
borderRadius: 9999,
27-
},
28-
}));
18+
return (
19+
<div
20+
aria-hidden
21+
css={{
22+
width: theme.spacing(1),
23+
height: theme.spacing(1),
24+
backgroundColor: variant === "solid" ? color : undefined,
25+
border: variant === "outlined" ? `1px solid ${color}` : undefined,
26+
borderRadius: 9999,
27+
}}
28+
/>
29+
);
30+
};
2931

3032
interface LastUsedProps {
3133
lastUsedAt: string;
3234
}
3335

3436
export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
35-
const theme: Theme = useTheme();
36-
const styles = useStyles();
37+
const theme = useTheme();
3738
const t = dayjs(lastUsedAt);
3839
const now = dayjs();
3940
let message = t.fromNow();
40-
let circle: JSX.Element = (
41+
let circle = (
4142
<Circle color={theme.palette.text.secondary} variant="outlined" />
4243
);
4344

@@ -59,7 +60,7 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
5960

6061
return (
6162
<Stack
62-
className={styles.root}
63+
css={{ color: theme.palette.text.secondary }}
6364
direction="row"
6465
spacing={1}
6566
alignItems="center"
@@ -69,9 +70,3 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
6970
</Stack>
7071
);
7172
};
72-
73-
const useStyles = makeStyles((theme) => ({
74-
root: {
75-
color: theme.palette.text.secondary,
76-
},
77-
}));

0 commit comments

Comments
 (0)