1
- import { makeStyles , useTheme } from "@mui/styles" ;
2
- import { FC } from "react" ;
1
+ import { type FC } from "react" ;
3
2
import dayjs from "dayjs" ;
4
3
import relativeTime from "dayjs/plugin/relativeTime" ;
5
- import { colors } from "theme/colors " ;
4
+ import { useTheme } from "@emotion/react " ;
6
5
import { Stack } from "components/Stack/Stack" ;
7
- import { Theme } from "@mui/material/styles " ;
6
+ import { colors } from "theme/colors " ;
8
7
9
8
dayjs . extend ( relativeTime ) ;
10
9
11
- type CircleProps = { color : string ; variant ?: "solid" | "outlined" } ;
10
+ type CircleProps = {
11
+ color : string ;
12
+ variant ?: "solid" | "outlined" ;
13
+ } ;
12
14
13
15
const Circle : FC < CircleProps > = ( { color, variant = "solid" } ) => {
14
- const styles = useCircleStyles ( { color, variant } ) ;
15
- return < div className = { styles . root } /> ;
16
- } ;
16
+ const theme = useTheme ( ) ;
17
17
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
+ } ;
29
31
30
32
interface LastUsedProps {
31
33
lastUsedAt : string ;
32
34
}
33
35
34
36
export const LastUsed : FC < LastUsedProps > = ( { lastUsedAt } ) => {
35
- const theme : Theme = useTheme ( ) ;
36
- const styles = useStyles ( ) ;
37
+ const theme = useTheme ( ) ;
37
38
const t = dayjs ( lastUsedAt ) ;
38
39
const now = dayjs ( ) ;
39
40
let message = t . fromNow ( ) ;
40
- let circle : JSX . Element = (
41
+ let circle = (
41
42
< Circle color = { theme . palette . text . secondary } variant = "outlined" />
42
43
) ;
43
44
@@ -59,7 +60,7 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
59
60
60
61
return (
61
62
< Stack
62
- className = { styles . root }
63
+ css = { { color : theme . palette . text . secondary } }
63
64
direction = "row"
64
65
spacing = { 1 }
65
66
alignItems = "center"
@@ -69,9 +70,3 @@ export const LastUsed: FC<LastUsedProps> = ({ lastUsedAt }) => {
69
70
</ Stack >
70
71
) ;
71
72
} ;
72
-
73
- const useStyles = makeStyles ( ( theme ) => ( {
74
- root : {
75
- color : theme . palette . text . secondary ,
76
- } ,
77
- } ) ) ;
0 commit comments