1
- import { makeStyles } from "@mui/styles " ;
1
+ import { type Interpolation , type Theme } from "@emotion/react " ;
2
2
import { ErrorAlert } from "components/Alert/ErrorAlert" ;
3
3
import { Loader } from "components/Loader/Loader" ;
4
4
import { Margins } from "components/Margins/Margins" ;
@@ -9,10 +9,9 @@ import {
9
9
} from "components/PageHeader/PageHeader" ;
10
10
import { Stack } from "components/Stack/Stack" ;
11
11
import { TemplateExampleCard } from "components/TemplateExampleCard/TemplateExampleCard" ;
12
- import { FC } from "react" ;
12
+ import { type FC } from "react" ;
13
13
import { Link , useSearchParams } from "react-router-dom" ;
14
- import { combineClasses } from "utils/combineClasses" ;
15
- import { StarterTemplatesByTag } from "utils/starterTemplates" ;
14
+ import type { StarterTemplatesByTag } from "utils/starterTemplates" ;
16
15
17
16
const getTagLabel = ( tag : string ) => {
18
17
const labelByTag : Record < string , string > = {
@@ -40,7 +39,6 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({
40
39
error,
41
40
} ) => {
42
41
const [ urlParams ] = useSearchParams ( ) ;
43
- const styles = useStyles ( ) ;
44
42
const tags = starterTemplatesByTag
45
43
? selectTags ( starterTemplatesByTag )
46
44
: undefined ;
@@ -64,24 +62,24 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({
64
62
65
63
< Stack direction = "row" spacing = { 4 } >
66
64
{ starterTemplatesByTag && tags && (
67
- < Stack className = { styles . filter } >
68
- < span className = { styles . filterCaption } > Filter</ span >
65
+ < Stack css = { styles . filter } >
66
+ < span css = { styles . filterCaption } > Filter</ span >
69
67
{ tags . map ( ( tag ) => (
70
68
< Link
71
69
key = { tag }
72
70
to = { `?tag=${ tag } ` }
73
- className = { combineClasses ( {
74
- [ styles . tagLink ] : true ,
75
- [ styles . tagLinkActive ] : tag === activeTag ,
76
- } ) }
71
+ css = { [
72
+ styles . tagLink ,
73
+ tag === activeTag && styles . tagLinkActive ,
74
+ ] }
77
75
>
78
76
{ getTagLabel ( tag ) } ({ starterTemplatesByTag [ tag ] . length } )
79
77
</ Link >
80
78
) ) }
81
79
</ Stack >
82
80
) }
83
81
84
- < div className = { styles . templates } >
82
+ < div css = { styles . templates } >
85
83
{ visibleTemplates &&
86
84
visibleTemplates . map ( ( example ) => (
87
85
< TemplateExampleCard example = { example } key = { example . id } />
@@ -92,21 +90,21 @@ export const StarterTemplatesPageView: FC<StarterTemplatesPageViewProps> = ({
92
90
) ;
93
91
} ;
94
92
95
- const useStyles = makeStyles ( ( theme ) => ( {
96
- filter : {
93
+ const styles = {
94
+ filter : ( theme ) => ( {
97
95
width : theme . spacing ( 26 ) ,
98
96
flexShrink : 0 ,
99
- } ,
97
+ } ) ,
100
98
101
- filterCaption : {
99
+ filterCaption : ( theme ) => ( {
102
100
textTransform : "uppercase" ,
103
101
fontWeight : 600 ,
104
102
fontSize : 12 ,
105
103
color : theme . palette . text . secondary ,
106
104
letterSpacing : "0.1em" ,
107
- } ,
105
+ } ) ,
108
106
109
- tagLink : {
107
+ tagLink : ( theme ) => ( {
110
108
color : theme . palette . text . secondary ,
111
109
textDecoration : "none" ,
112
110
fontSize : 14 ,
@@ -115,18 +113,18 @@ const useStyles = makeStyles((theme) => ({
115
113
"&:hover" : {
116
114
color : theme . palette . text . primary ,
117
115
} ,
118
- } ,
116
+ } ) ,
119
117
120
- tagLinkActive : {
118
+ tagLinkActive : ( theme ) => ( {
121
119
color : theme . palette . text . primary ,
122
120
fontWeight : 600 ,
123
- } ,
121
+ } ) ,
124
122
125
- templates : {
123
+ templates : ( theme ) => ( {
126
124
flex : "1" ,
127
125
display : "grid" ,
128
126
gridTemplateColumns : "repeat(2, minmax(0, 1fr))" ,
129
127
gap : theme . spacing ( 2 ) ,
130
128
gridAutoRows : "min-content" ,
131
- } ,
132
- } ) ) ;
129
+ } ) ,
130
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments