Skip to content

chore: use emotion for styling (pt. 3) #10026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Oct 5, 2023
Prev Previous commit
Next Next commit
emotion: CreateUserForm
  • Loading branch information
aslilac committed Oct 3, 2023
commit 515511c6bae4cc052f670f5f6d5ab4d2a8e91554
28 changes: 11 additions & 17 deletions site/src/pages/CreateUserPage/CreateUserForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem";
import Link from "@mui/material/Link";
import { FormikContextType, useFormik } from "formik";
import { FC } from "react";
import * as Yup from "yup";
import { hasApiFieldErrors, isApiError } from "api/errors";
import * as TypesGen from "api/typesGenerated";
import {
getFormHelpers,
Expand All @@ -12,11 +15,6 @@ import { FormFooter } from "components/FormFooter/FormFooter";
import { FullPageForm } from "components/FullPageForm/FullPageForm";
import { Stack } from "components/Stack/Stack";
import { ErrorAlert } from "components/Alert/ErrorAlert";
import { hasApiFieldErrors, isApiError } from "api/errors";
import MenuItem from "@mui/material/MenuItem";
import { makeStyles } from "@mui/styles";
import { Theme } from "@mui/material/styles";
import Link from "@mui/material/Link";

export const Language = {
emailLabel: "Email",
Expand Down Expand Up @@ -104,8 +102,6 @@ export const CreateUserForm: FC<
error,
);

const styles = useStyles();

const methods = [
authMethods?.password.enabled && "password",
authMethods?.oidc.enabled && "oidc",
Expand Down Expand Up @@ -163,7 +159,14 @@ export const CreateUserForm: FC<
<MenuItem key={value} id={"item-" + value} value={value}>
<Stack spacing={0} maxWidth={400}>
{language.displayName}
<span className={styles.labelDescription}>
<span
css={(theme) => ({
fontSize: 14,
color: theme.palette.text.secondary,
wordWrap: "normal",
whiteSpace: "break-spaces",
})}
>
{language.description}
</span>
</Stack>
Expand Down Expand Up @@ -192,12 +195,3 @@ export const CreateUserForm: FC<
</FullPageForm>
);
};

const useStyles = makeStyles<Theme>((theme) => ({
labelDescription: {
fontSize: 14,
color: theme.palette.text.secondary,
wordWrap: "normal",
whiteSpace: "break-spaces",
},
}));