Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reuseable

Manav Rathif64e62ba61f9
diff --git a/web/packages/base/components/loaders.tsx b/web/packages/base/components/loaders.tsx
index 34ddef1d7d..45c2f6d665 100644
--- a/web/packages/base/components/loaders.tsx
+++ b/web/packages/base/components/loaders.tsx
@@ -1,5 +1,6 @@
import { Overlay, Stack100vhCenter } from "@/base/components/containers";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
+import { Backdrop } from "@mui/material";
import React from "react";
/**
@@ -41,15 +42,14 @@ export const LoadingOverlay: React.FC = () => (
* Used as a overscreen during blocking actions.
*/
export const TranslucentLoadingOverlay: React.FC = () => (
- <Overlay
+ <Backdrop
+ open={true}
+ variant="blur"
sx={{
- display: "flex",
- justifyContent: "center",
- alignItems: "center",
+ // TODO: Why?
zIndex: 9000,
- backgroundColor: "backdrop.muted",
}}
>
<ActivityIndicator />
- </Overlay>
+ </Backdrop>
);
diff --git a/web/packages/base/components/utils/mui-theme.d.ts b/web/packages/base/components/utils/mui-theme.d.ts
index 17a2df19cb..b4b3177993 100644
--- a/web/packages/base/components/utils/mui-theme.d.ts
+++ b/web/packages/base/components/utils/mui-theme.d.ts
@@ -285,3 +285,17 @@ declare module "@mui/material/Typography" {
tiny: true;
}
}
+
+// Tell TypeScript about our custom variants for other components
+//
+// https://mui.com/material-ui/customization/theme-components/#variants
+
+declare module "@mui/material/Backdrop" {
+ interface BackdropPropVariantOverrides {
+ /**
+ * A variant that uses a translucent blur filter over the background of
+ * the backdrop.
+ */
+ blur: true;
+ }
+}
diff --git a/web/packages/base/components/utils/theme.ts b/web/packages/base/components/utils/theme.ts
index 19dbb485ce..544325ceff 100644
--- a/web/packages/base/components/utils/theme.ts
+++ b/web/packages/base/components/utils/theme.ts
@@ -498,6 +498,14 @@ const typography: TypographyOptions = {
},
};
+/**
+ * > [!NOTE]
+ * >
+ * > The theme isn't tree-shakeable, prefer creating new components for heavy
+ * > customization.
+ * >
+ * > https://mui.com/material-ui/customization/theme-components/
+ */
const components: Components = {
MuiCssBaseline: {
styleOverrides: {
@@ -542,16 +550,32 @@ const components: Components = {
},
},
- MuiDrawer: {
+ MuiBackdrop: {
styleOverrides: {
root: {
- ".MuiBackdrop-root": {
- backgroundColor: "var(--mui-palette-backdrop-muted)",
- },
+ backgroundColor: "var(--mui-palette-backdrop-muted)",
+ variants: [
+ {
+ props: { variant: "blur" },
+ style: {
+ backdropFilter: "blur(30px) opacity(95%)",
+ },
+ },
+ ],
},
},
},
+ // MuiDrawer: {
+ // styleOverrides: {
+ // root: {
+ // ".MuiBackdrop-root": {
+ // backgroundColor: "var(--mui-palette-backdrop-muted)",
+ // },
+ // },
+ // },
+ // },
+
MuiDialog: {
defaultProps: {
// This is required to prevent console errors about aria-hiding a
@@ -562,9 +586,6 @@ const components: Components = {
},
styleOverrides: {
root: {
- ".MuiBackdrop-root": {
- backgroundColor: "var(--mui-palette-backdrop-muted)",
- },
// Reset the MUI default paddings to 16px everywhere.
//
// This is not a great choice either, usually most dialogs, for