1
- import { makeStyles } from "@mui/styles" ;
1
+ import { css } from "@emotion/css" ;
2
+ import { useTheme , type Interpolation , type Theme } from "@emotion/react" ;
2
3
import Dialog from "@mui/material/Dialog" ;
3
4
import DialogContent from "@mui/material/DialogContent" ;
4
5
import DialogContentText from "@mui/material/DialogContentText" ;
5
6
import DialogTitle from "@mui/material/DialogTitle" ;
6
- import { DialogProps } from "components/Dialogs/Dialog" ;
7
- import { FC , useEffect , useState } from "react" ;
7
+ import { type DialogProps } from "components/Dialogs/Dialog" ;
8
+ import { type FC , useEffect , useState } from "react" ;
8
9
import { FormFields , VerticalForm } from "components/Form/Form" ;
9
- import { TemplateVersionVariable , VariableValue } from "api/typesGenerated" ;
10
+ import type {
11
+ TemplateVersionVariable ,
12
+ VariableValue ,
13
+ } from "api/typesGenerated" ;
10
14
import DialogActions from "@mui/material/DialogActions" ;
11
15
import Button from "@mui/material/Button" ;
12
16
import { VariableInput } from "pages/CreateTemplatePage/VariableInput" ;
@@ -24,7 +28,7 @@ export type MissingTemplateVariablesDialogProps = Omit<
24
28
export const MissingTemplateVariablesDialog : FC <
25
29
MissingTemplateVariablesDialogProps
26
30
> = ( { missingVariables, onSubmit, ...dialogProps } ) => {
27
- const styles = useStyles ( ) ;
31
+ const theme = useTheme ( ) ;
28
32
const [ variableValues , setVariableValues ] = useState < VariableValue [ ] > ( [ ] ) ;
29
33
30
34
// Pre-fill the form with the default values when missing variables are loaded
@@ -47,16 +51,25 @@ export const MissingTemplateVariablesDialog: FC<
47
51
>
48
52
< DialogTitle
49
53
id = "update-build-parameters-title"
50
- classes = { { root : styles . title } }
54
+ classes = { {
55
+ root : css `
56
+ padding : ${ theme . spacing ( 3 , 5 ) } ;
57
+
58
+ & h2 {
59
+ font-size : ${ theme . spacing ( 2.5 ) } ;
60
+ font-weight : 400 ;
61
+ }
62
+ ` ,
63
+ } }
51
64
>
52
65
Template variables
53
66
</ DialogTitle >
54
- < DialogContent className = { styles . content } >
55
- < DialogContentText className = { styles . info } >
67
+ < DialogContent css = { styles . content } >
68
+ < DialogContentText css = { styles . info } >
56
69
There are a few missing template variable values. Please fill them in.
57
70
</ DialogContentText >
58
71
< VerticalForm
59
- className = { styles . form }
72
+ css = { styles . form }
60
73
id = "updateVariables"
61
74
onSubmit = { ( e ) => {
62
75
e . preventDefault ( ) ;
@@ -89,7 +102,7 @@ export const MissingTemplateVariablesDialog: FC<
89
102
) }
90
103
</ VerticalForm >
91
104
</ DialogContent >
92
- < DialogActions disableSpacing className = { styles . dialogActions } >
105
+ < DialogActions disableSpacing css = { styles . dialogActions } >
93
106
< Button color = "primary" fullWidth type = "submit" form = "updateVariables" >
94
107
Submit
95
108
</ Button >
@@ -101,43 +114,22 @@ export const MissingTemplateVariablesDialog: FC<
101
114
) ;
102
115
} ;
103
116
104
- const useStyles = makeStyles ( ( theme ) => ( {
105
- title : {
106
- padding : theme . spacing ( 3 , 5 ) ,
107
-
108
- "& h2" : {
109
- fontSize : theme . spacing ( 2.5 ) ,
110
- fontWeight : 400 ,
111
- } ,
112
- } ,
113
-
114
- content : {
115
- padding : theme . spacing ( 0 , 5 , 0 , 5 ) ,
116
- } ,
117
+ const styles = {
118
+ content : ( theme ) => ( {
119
+ padding : theme . spacing ( 0 , 5 ) ,
120
+ } ) ,
117
121
118
122
info : {
119
123
margin : 0 ,
120
124
} ,
121
125
122
- form : {
126
+ form : ( theme ) => ( {
123
127
paddingTop : theme . spacing ( 4 ) ,
124
- } ,
128
+ } ) ,
125
129
126
- infoTitle : {
127
- fontSize : theme . spacing ( 2 ) ,
128
- fontWeight : 600 ,
129
- display : "flex" ,
130
- alignItems : "center" ,
131
- gap : theme . spacing ( 1 ) ,
132
- } ,
133
-
134
- formFooter : {
135
- flexDirection : "column" ,
136
- } ,
137
-
138
- dialogActions : {
130
+ dialogActions : ( theme ) => ( {
139
131
padding : theme . spacing ( 5 ) ,
140
132
flexDirection : "column" ,
141
133
gap : theme . spacing ( 1 ) ,
142
- } ,
143
- } ) ) ;
134
+ } ) ,
135
+ } satisfies Record < string , Interpolation < Theme > > ;
0 commit comments