Skip to content

Commit d2b5602

Browse files
committed
emotion: VariableInput
1 parent 51ca0b9 commit d2b5602

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

site/src/pages/CreateTemplatePage/VariableInput.tsx

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
1+
import { type Interpolation, type Theme } from "@emotion/react";
12
import FormControlLabel from "@mui/material/FormControlLabel";
23
import Radio from "@mui/material/Radio";
34
import RadioGroup from "@mui/material/RadioGroup";
4-
import { makeStyles } from "@mui/styles";
55
import TextField from "@mui/material/TextField";
66
import { Stack } from "components/Stack/Stack";
7-
import { FC } from "react";
8-
import { TemplateVersionVariable } from "api/typesGenerated";
7+
import { type FC } from "react";
8+
import type { TemplateVersionVariable } from "api/typesGenerated";
99

1010
const isBoolean = (variable: TemplateVersionVariable) => {
1111
return variable.type === "bool";
1212
};
1313

14-
const VariableLabel: React.FC<{ variable: TemplateVersionVariable }> = ({
14+
const VariableLabel: FC<{ variable: TemplateVersionVariable }> = ({
1515
variable,
1616
}) => {
17-
const styles = useStyles();
18-
1917
return (
2018
<label htmlFor={variable.name}>
21-
<span className={styles.labelName}>
19+
<span css={styles.labelName}>
2220
var.{variable.name}
2321
{!variable.required && " (optional)"}
2422
</span>
25-
<span className={styles.labelDescription}>{variable.description}</span>
23+
<span css={styles.labelDescription}>{variable.description}</span>
2624
</label>
2725
);
2826
};
@@ -40,12 +38,10 @@ export const VariableInput: FC<VariableInputProps> = ({
4038
variable,
4139
defaultValue,
4240
}) => {
43-
const styles = useStyles();
44-
4541
return (
4642
<Stack direction="column" spacing={0.75}>
4743
<VariableLabel variable={variable} />
48-
<div className={styles.input}>
44+
<div css={styles.input}>
4945
<VariableField
5046
disabled={disabled}
5147
onChange={onChange}
@@ -113,26 +109,21 @@ const VariableField: React.FC<VariableInputProps> = ({
113109
);
114110
};
115111

116-
const useStyles = makeStyles((theme) => ({
117-
labelName: {
112+
const styles = {
113+
labelName: (theme) => ({
118114
fontSize: 14,
119115
color: theme.palette.text.secondary,
120116
display: "block",
121117
marginBottom: theme.spacing(0.5),
122-
},
123-
labelDescription: {
118+
}),
119+
labelDescription: (theme) => ({
124120
fontSize: 16,
125121
color: theme.palette.text.primary,
126122
display: "block",
127123
fontWeight: 600,
128-
},
124+
}),
129125
input: {
130126
display: "flex",
131127
flexDirection: "column",
132128
},
133-
checkbox: {
134-
display: "flex",
135-
alignItems: "center",
136-
gap: theme.spacing(1),
137-
},
138-
}));
129+
} satisfies Record<string, Interpolation<Theme>>;

0 commit comments

Comments
 (0)