1
+ import { type Interpolation , type Theme } from "@emotion/react" ;
1
2
import Button from "@mui/material/Button" ;
2
- import { makeStyles } from "@mui/styles" ;
3
3
import Table from "@mui/material/Table" ;
4
4
import TableBody from "@mui/material/TableBody" ;
5
5
import TableCell from "@mui/material/TableCell" ;
6
6
import TableContainer from "@mui/material/TableContainer" ;
7
7
import TableHead from "@mui/material/TableHead" ;
8
8
import TableRow from "@mui/material/TableRow" ;
9
9
import AddIcon from "@mui/icons-material/AddOutlined" ;
10
- import { FC } from "react" ;
10
+ import { type FC } from "react" ;
11
11
import { useNavigate , Link as RouterLink } from "react-router-dom" ;
12
12
import { createDayString } from "utils/createDayString" ;
13
13
import {
@@ -35,7 +35,7 @@ import {
35
35
} from "components/HelpTooltip/HelpTooltip" ;
36
36
import { EmptyTemplates } from "./EmptyTemplates" ;
37
37
import { useClickableTableRow } from "hooks/useClickableTableRow" ;
38
- import { Template , TemplateExample } from "api/typesGenerated" ;
38
+ import type { Template , TemplateExample } from "api/typesGenerated" ;
39
39
import { combineClasses } from "utils/combineClasses" ;
40
40
import { colors } from "theme/colors" ;
41
41
import ArrowForwardOutlined from "@mui/icons-material/ArrowForwardOutlined" ;
@@ -80,17 +80,17 @@ const TemplateRow: FC<{ template: Template }> = ({ template }) => {
80
80
const templatePageLink = `/templates/${ template . name } ` ;
81
81
const hasIcon = template . icon && template . icon !== "" ;
82
82
const navigate = useNavigate ( ) ;
83
- const styles = useStyles ( ) ;
84
83
85
- const { className : clickableClassName , ...clickableRow } =
86
- useClickableTableRow ( { onClick : ( ) => navigate ( templatePageLink ) } ) ;
84
+ const { css : clickableCss , ...clickableRow } = useClickableTableRow ( {
85
+ onClick : ( ) => navigate ( templatePageLink ) ,
86
+ } ) ;
87
87
88
88
return (
89
89
< TableRow
90
90
key = { template . id }
91
91
data-testid = { `template-${ template . id } ` }
92
92
{ ...clickableRow }
93
- className = { combineClasses ( [ clickableClassName , styles . tableRow ] ) }
93
+ css = { [ clickableCss , styles . tableRow ] }
94
94
>
95
95
< TableCell >
96
96
< AvatarData
@@ -106,22 +106,23 @@ const TemplateRow: FC<{ template: Template }> = ({ template }) => {
106
106
/>
107
107
</ TableCell >
108
108
109
- < TableCell className = { styles . secondary } >
109
+ < TableCell css = { styles . secondary } >
110
110
{ Language . developerCount ( template . active_user_count ) }
111
111
</ TableCell >
112
112
113
- < TableCell className = { styles . secondary } >
113
+ < TableCell css = { styles . secondary } >
114
114
{ formatTemplateBuildTime ( template . build_time_stats . start . P50 ) }
115
115
</ TableCell >
116
116
117
- < TableCell data-chromatic = "ignore" className = { styles . secondary } >
117
+ < TableCell data-chromatic = "ignore" css = { styles . secondary } >
118
118
{ createDayString ( template . updated_at ) }
119
119
</ TableCell >
120
120
121
- < TableCell className = { styles . actionCell } >
121
+ < TableCell css = { styles . actionCell } >
122
122
< Button
123
123
size = "small"
124
- className = { styles . actionButton }
124
+ css = { styles . actionButton }
125
+ className = "actionButton"
125
126
startIcon = { < ArrowForwardOutlined /> }
126
127
title = { `Create a workspace using the ${ template . display_name } template` }
127
128
onClick = { ( e ) => {
@@ -247,7 +248,7 @@ const TableLoader = () => {
247
248
) ;
248
249
} ;
249
250
250
- const useStyles = makeStyles ( ( theme ) => ( {
251
+ const styles = {
251
252
templateIconWrapper : {
252
253
// Same size then the avatar component
253
254
width : 36 ,
@@ -261,20 +262,20 @@ const useStyles = makeStyles((theme) => ({
261
262
actionCell : {
262
263
whiteSpace : "nowrap" ,
263
264
} ,
264
- secondary : {
265
+ secondary : ( theme ) => ( {
265
266
color : theme . palette . text . secondary ,
266
- } ,
267
- tableRow : {
268
- "&:hover $ actionButton" : {
267
+ } ) ,
268
+ tableRow : ( theme ) => ( {
269
+ "&:hover . actionButton" : {
269
270
color : theme . palette . text . primary ,
270
271
borderColor : colors . gray [ 11 ] ,
271
272
"&:hover" : {
272
273
borderColor : theme . palette . text . primary ,
273
274
} ,
274
275
} ,
275
- } ,
276
- actionButton : {
276
+ } ) ,
277
+ actionButton : ( theme ) => ( {
277
278
color : theme . palette . text . secondary ,
278
279
transition : "none" ,
279
- } ,
280
- } ) ) ;
280
+ } ) ,
281
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments