1
+ import { useTheme , type CSSObject } from "@emotion/react" ;
1
2
import { type MouseEventHandler } from "react" ;
2
3
import { type TableRowProps } from "@mui/material/TableRow" ;
3
- import { makeStyles } from "@mui/styles" ;
4
4
import { useClickable , type UseClickableResult } from "./useClickable" ;
5
5
6
6
type UseClickableTableRowResult = UseClickableResult < HTMLTableRowElement > &
7
7
TableRowProps & {
8
- className : string ;
8
+ css : CSSObject ;
9
9
hover : true ;
10
10
onAuxClick : MouseEventHandler < HTMLTableRowElement > ;
11
11
} ;
@@ -28,12 +28,24 @@ export const useClickableTableRow = ({
28
28
onDoubleClick,
29
29
onMiddleClick,
30
30
} : UseClickableTableRowConfig ) : UseClickableTableRowResult => {
31
- const styles = useStyles ( ) ;
32
31
const clickableProps = useClickable ( onClick ) ;
32
+ const theme = useTheme ( ) ;
33
33
34
34
return {
35
35
...clickableProps ,
36
- className : styles . row ,
36
+ css : {
37
+ cursor : "pointer" ,
38
+
39
+ "&:focus" : {
40
+ outline : `1px solid ${ theme . palette . secondary . dark } ` ,
41
+ outlineOffset : - 1 ,
42
+ } ,
43
+
44
+ "&:last-of-type" : {
45
+ borderBottomLeftRadius : theme . shape . borderRadius ,
46
+ borderBottomRightRadius : theme . shape . borderRadius ,
47
+ } ,
48
+ } ,
37
49
hover : true ,
38
50
onDoubleClick,
39
51
onAuxClick : ( event ) => {
@@ -46,19 +58,3 @@ export const useClickableTableRow = ({
46
58
} ,
47
59
} ;
48
60
} ;
49
-
50
- const useStyles = makeStyles ( ( theme ) => ( {
51
- row : {
52
- cursor : "pointer" ,
53
-
54
- "&:focus" : {
55
- outline : `1px solid ${ theme . palette . secondary . dark } ` ,
56
- outlineOffset : - 1 ,
57
- } ,
58
-
59
- "&:last-of-type" : {
60
- borderBottomLeftRadius : theme . shape . borderRadius ,
61
- borderBottomRightRadius : theme . shape . borderRadius ,
62
- } ,
63
- } ,
64
- } ) ) ;
0 commit comments