Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Move

Manav Rathica08b3eb5fb7
diff --git a/web/packages/new/photos/components/SingleInputFormV2.tsx b/web/packages/new/photos/components/SingleInputFormV2.tsx
index 5e7117e03a..bf72f19e13 100644
--- a/web/packages/new/photos/components/SingleInputFormV2.tsx
+++ b/web/packages/new/photos/components/SingleInputFormV2.tsx
@@ -2,12 +2,10 @@ import log from "@/base/log";
import { wait } from "@/utils/promise";
import {
Box,
- CircularProgress,
Dialog,
DialogContent,
DialogTitle,
TextField,
- type ButtonProps,
type TextFieldProps,
} from "@mui/material";
import { useFormik } from "formik";
@@ -15,6 +13,7 @@ import { t } from "i18next";
import React from "react";
import { FocusVisibleButton } from "./FocusVisibleButton";
import type { DialogVisibilityProps } from "./mui/Dialog";
+import { LoadingButton } from "./mui/LoadingButton";
type SingleInputFormProps = Pick<
TextFieldProps,
@@ -123,38 +122,6 @@ export const SingleInputFormV2: React.FC<SingleInputFormProps> = ({
);
};
-/**
- * A button that shows a indeterminate progress indicator if the {@link loading}
- * prop is set.
- *
- * TODO: This duplicates the existing SubmitButton and EnteButton. Merge these
- * three gradually (didn't want to break existing layouts, so will do it
- * piecewise).
- */
-export const LoadingButton: React.FC<ButtonProps & { loading?: boolean }> = ({
- loading,
- disabled,
- color,
- sx,
- children,
- ...rest
-}) => (
- <FocusVisibleButton
- {...{ color }}
- disabled={loading ?? disabled}
- sx={{
- "&.Mui-disabled": {
- backgroundColor: "accent.main",
- color: "accent.contrastText",
- },
- ...sx,
- }}
- {...rest}
- >
- {loading ? <CircularProgress size={20} /> : children}
- </FocusVisibleButton>
-);
-
export const SingleInputDialogTest: React.FC<DialogVisibilityProps> = ({
open,
onClose,
diff --git a/web/packages/new/photos/components/mui/LoadingButton.tsx b/web/packages/new/photos/components/mui/LoadingButton.tsx
new file mode 100644
index 0000000000..a129c32cac
--- /dev/null
+++ b/web/packages/new/photos/components/mui/LoadingButton.tsx
@@ -0,0 +1,37 @@
+import { CircularProgress, type ButtonProps } from "@mui/material";
+import React from "react";
+import { FocusVisibleButton } from "../FocusVisibleButton";
+
+/**
+ * A button that shows a indeterminate progress indicator if the {@link loading}
+ * prop is set.
+ *
+ * The button is also disabled when in the loading state.
+ *
+ * TODO: This duplicates the existing SubmitButton and EnteButton. Merge these
+ * three gradually (didn't want to break existing layouts, so will do it
+ * piecewise).
+ */
+export const LoadingButton: React.FC<ButtonProps & { loading?: boolean }> = ({
+ loading,
+ disabled,
+ color,
+ sx,
+ children,
+ ...rest
+}) => (
+ <FocusVisibleButton
+ {...{ color }}
+ disabled={loading ?? disabled}
+ sx={{
+ "&.Mui-disabled": {
+ backgroundColor: `${color}.main`,
+ color: `${color}.contrastText`,
+ },
+ ...sx,
+ }}
+ {...rest}
+ >
+ {loading ? <CircularProgress size={20} /> : children}
+ </FocusVisibleButton>
+);