Skip to content

Commit ac32272

Browse files
chore(site): replace custom LoadingButton from the one in MUI (#10351)
1 parent 3d9bfdd commit ac32272

File tree

15 files changed

+36
-89
lines changed

15 files changed

+36
-89
lines changed

site/src/components/Dialogs/Dialog.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import MuiDialog, { DialogProps as MuiDialogProps } from "@mui/material/Dialog";
22
import { type ReactNode } from "react";
33
import { colors } from "theme/colors";
4-
import {
5-
LoadingButton,
6-
LoadingButtonProps,
7-
} from "../LoadingButton/LoadingButton";
84
import { ConfirmDialogType } from "./types";
95
import { type Interpolation, type Theme } from "@emotion/react";
6+
import LoadingButton, { LoadingButtonProps } from "@mui/lab/LoadingButton";
107

118
export interface DialogActionButtonsProps {
129
/** Text to display in the cancel button */

site/src/components/FormFooter/FormFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Button from "@mui/material/Button";
22
import { type FC } from "react";
3-
import { LoadingButton } from "../LoadingButton/LoadingButton";
43
import { Interpolation, Theme } from "@emotion/react";
4+
import LoadingButton from "@mui/lab/LoadingButton";
55

66
export const Language = {
77
cancelLabel: "Cancel",

site/src/components/LoadingButton/LoadingButton.stories.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

site/src/components/LoadingButton/LoadingButton.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

site/src/pages/CreateWorkspacePage/ExternalAuth.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import Button from "@mui/material/Button";
33
import FormHelperText from "@mui/material/FormHelperText";
44
import Tooltip from "@mui/material/Tooltip";
55
import { type FC } from "react";
6-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
76
import { Stack } from "components/Stack/Stack";
87
import { type ExternalAuthPollingState } from "./CreateWorkspacePage";
8+
import LoadingButton from "@mui/lab/LoadingButton";
99

1010
export interface ExternalAuthProps {
1111
displayName: string;
@@ -34,6 +34,7 @@ export const ExternalAuth: FC<ExternalAuthProps> = (props) => {
3434
>
3535
<Stack alignItems="center" spacing={1}>
3636
<LoadingButton
37+
loadingPosition="start"
3738
loading={externalAuthPollingState === "polling"}
3839
href={authenticateURL}
3940
variant="contained"
@@ -42,8 +43,8 @@ export const ExternalAuth: FC<ExternalAuthProps> = (props) => {
4243
<img
4344
src={displayIcon}
4445
alt={`${displayName} Icon`}
45-
width={24}
46-
height={24}
46+
width={16}
47+
height={16}
4748
/>
4849
}
4950
disabled={authenticated}

site/src/pages/DeploySettingsPage/LicensesSettingsPage/LicensesSettingsPageView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Link } from "react-router-dom";
1313
import useWindowSize from "react-use/lib/useWindowSize";
1414
import MuiLink from "@mui/material/Link";
1515
import Tooltip from "@mui/material/Tooltip";
16-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
16+
import LoadingButton from "@mui/lab/LoadingButton";
1717

1818
type Props = {
1919
showConfetti: boolean;
@@ -72,6 +72,7 @@ const LicensesSettingsPageView: FC<Props> = ({
7272
</Button>
7373
<Tooltip title="Refresh license entitlements. This is done automatically every 10 minutes.">
7474
<LoadingButton
75+
loadingPosition="start"
7576
loading={isRefreshing}
7677
onClick={refreshEntitlements}
7778
startIcon={<RefreshIcon />}

site/src/pages/GroupsPage/GroupPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { AvatarData } from "components/AvatarData/AvatarData";
1313
import { DeleteDialog } from "components/Dialogs/DeleteDialog/DeleteDialog";
1414
import { EmptyState } from "components/EmptyState/EmptyState";
1515
import { Loader } from "components/Loader/Loader";
16-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
1716
import { Margins } from "components/Margins/Margins";
1817
import {
1918
PageHeader,
@@ -44,6 +43,7 @@ import {
4443
} from "api/queries/groups";
4544
import { displayError, displaySuccess } from "components/GlobalSnackbar/utils";
4645
import { getErrorMessage } from "api/errors";
46+
import LoadingButton from "@mui/lab/LoadingButton";
4747

4848
export const GroupPage: FC = () => {
4949
const { groupId } = useParams() as { groupId: string };
@@ -235,6 +235,7 @@ const AddGroupMember: React.FC<{
235235
/>
236236

237237
<LoadingButton
238+
loadingPosition="start"
238239
disabled={!selectedUser}
239240
type="submit"
240241
startIcon={<PersonAdd />}

site/src/pages/LoginPage/PasswordSignInForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Stack } from "components/Stack/Stack";
22
import TextField from "@mui/material/TextField";
33
import { getFormHelpers, onChangeTrimmed } from "utils/formUtils";
4-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
54
import { Language } from "./SignInForm";
65
import { FormikContextType, FormikTouched, useFormik } from "formik";
76
import * as Yup from "yup";
87
import { FC } from "react";
98
import { BuiltInAuthFormValues } from "./SignInForm.types";
9+
import LoadingButton from "@mui/lab/LoadingButton";
1010

1111
type PasswordSignInFormProps = {
1212
onSubmit: (credentials: { email: string; password: string }) => void;
@@ -66,7 +66,7 @@ export const PasswordSignInForm: FC<PasswordSignInFormProps> = ({
6666
fullWidth
6767
type="submit"
6868
>
69-
{isSigningIn ? "" : Language.passwordSignIn}
69+
{Language.passwordSignIn}
7070
</LoadingButton>
7171
</div>
7272
</Stack>

site/src/pages/SetupPage/SetupPageView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Box from "@mui/material/Box";
22
import Checkbox from "@mui/material/Checkbox";
33
import TextField from "@mui/material/TextField";
44
import Typography from "@mui/material/Typography";
5-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
65
import { SignInLayout } from "components/SignInLayout/SignInLayout";
76
import { Stack } from "components/Stack/Stack";
87
import { Welcome } from "components/Welcome/Welcome";
@@ -14,6 +13,7 @@ import {
1413
} from "utils/formUtils";
1514
import * as Yup from "yup";
1615
import type * as TypesGen from "api/typesGenerated";
16+
import LoadingButton from "@mui/lab/LoadingButton";
1717

1818
export const Language = {
1919
emailLabel: "Email",

site/src/pages/TemplateSettingsPage/TemplatePermissionsPage/TemplatePermissionsPageView.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818
import { AvatarData } from "components/AvatarData/AvatarData";
1919
import { ChooseOne, Cond } from "components/Conditionals/ChooseOne";
2020
import { EmptyState } from "components/EmptyState/EmptyState";
21-
import { LoadingButton } from "components/LoadingButton/LoadingButton";
2221
import { Stack } from "components/Stack/Stack";
2322
import { TableLoader } from "components/TableLoader/TableLoader";
2423
import { TableRowMenu } from "components/TableRowMenu/TableRowMenu";
@@ -30,6 +29,7 @@ import { type FC, useState } from "react";
3029
import { GroupAvatar } from "components/GroupAvatar/GroupAvatar";
3130
import { getGroupSubtitle } from "utils/groups";
3231
import { PageHeader, PageHeaderTitle } from "components/PageHeader/PageHeader";
32+
import LoadingButton from "@mui/lab/LoadingButton";
3333

3434
type AddTemplateUserOrGroupProps = {
3535
organizationId: string;
@@ -106,6 +106,7 @@ const AddTemplateUserOrGroup: React.FC<AddTemplateUserOrGroupProps> = ({
106106
</Select>
107107

108108
<LoadingButton
109+
loadingPosition="start"
109110
disabled={!selectedRole || !selectedOption}
110111
type="submit"
111112
startIcon={<PersonAdd />}

0 commit comments

Comments
 (0)