Skip to content

Commit 9225685

Browse files
committed
emotion: MissingTemplateVariablesDialog
1 parent 0f69549 commit 9225685

File tree

1 file changed

+32
-40
lines changed

1 file changed

+32
-40
lines changed

site/src/pages/TemplateVersionEditorPage/MissingTemplateVariablesDialog.tsx

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import { makeStyles } from "@mui/styles";
1+
import { css } from "@emotion/css";
2+
import { useTheme, type Interpolation, type Theme } from "@emotion/react";
23
import Dialog from "@mui/material/Dialog";
34
import DialogContent from "@mui/material/DialogContent";
45
import DialogContentText from "@mui/material/DialogContentText";
56
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";
89
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";
1014
import DialogActions from "@mui/material/DialogActions";
1115
import Button from "@mui/material/Button";
1216
import { VariableInput } from "pages/CreateTemplatePage/VariableInput";
@@ -24,7 +28,7 @@ export type MissingTemplateVariablesDialogProps = Omit<
2428
export const MissingTemplateVariablesDialog: FC<
2529
MissingTemplateVariablesDialogProps
2630
> = ({ missingVariables, onSubmit, ...dialogProps }) => {
27-
const styles = useStyles();
31+
const theme = useTheme();
2832
const [variableValues, setVariableValues] = useState<VariableValue[]>([]);
2933

3034
// Pre-fill the form with the default values when missing variables are loaded
@@ -47,16 +51,25 @@ export const MissingTemplateVariablesDialog: FC<
4751
>
4852
<DialogTitle
4953
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+
}}
5164
>
5265
Template variables
5366
</DialogTitle>
54-
<DialogContent className={styles.content}>
55-
<DialogContentText className={styles.info}>
67+
<DialogContent css={styles.content}>
68+
<DialogContentText css={styles.info}>
5669
There are a few missing template variable values. Please fill them in.
5770
</DialogContentText>
5871
<VerticalForm
59-
className={styles.form}
72+
css={styles.form}
6073
id="updateVariables"
6174
onSubmit={(e) => {
6275
e.preventDefault();
@@ -89,7 +102,7 @@ export const MissingTemplateVariablesDialog: FC<
89102
)}
90103
</VerticalForm>
91104
</DialogContent>
92-
<DialogActions disableSpacing className={styles.dialogActions}>
105+
<DialogActions disableSpacing css={styles.dialogActions}>
93106
<Button color="primary" fullWidth type="submit" form="updateVariables">
94107
Submit
95108
</Button>
@@ -101,43 +114,22 @@ export const MissingTemplateVariablesDialog: FC<
101114
);
102115
};
103116

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+
}),
117121

118122
info: {
119123
margin: 0,
120124
},
121125

122-
form: {
126+
form: (theme) => ({
123127
paddingTop: theme.spacing(4),
124-
},
128+
}),
125129

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) => ({
139131
padding: theme.spacing(5),
140132
flexDirection: "column",
141133
gap: theme.spacing(1),
142-
},
143-
}));
134+
}),
135+
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)