mirror of
https://github.com/ente-io/ente.git
synced 2025-08-11 16:56:22 +00:00
MUI deprecations
This commit is contained in:
parent
369999e0aa
commit
8407816d14
@ -58,7 +58,7 @@ const ExportPendingList = (props: Iprops) => {
|
|||||||
<TitledMiniDialog
|
<TitledMiniDialog
|
||||||
open={props.isOpen}
|
open={props.isOpen}
|
||||||
onClose={props.onClose}
|
onClose={props.onClose}
|
||||||
slotProps={{ paper: { sx: { maxWidth: "444px" } } }}
|
paperMaxWidth="444px"
|
||||||
title={t("PENDING_ITEMS")}
|
title={t("PENDING_ITEMS")}
|
||||||
>
|
>
|
||||||
<ItemList
|
<ItemList
|
||||||
|
@ -393,9 +393,11 @@ const parseExifInfo = (
|
|||||||
return info;
|
return info;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FileInfoSidebar = styled((props: DialogProps) => (
|
const FileInfoSidebar = styled(
|
||||||
|
(props: Pick<DialogProps, "open" | "onClose" | "children">) => (
|
||||||
<SidebarDrawer {...props} anchor="right" />
|
<SidebarDrawer {...props} anchor="right" />
|
||||||
))({
|
),
|
||||||
|
)({
|
||||||
zIndex: fileInfoDrawerZIndex,
|
zIndex: fileInfoDrawerZIndex,
|
||||||
"& .MuiPaper-root": {
|
"& .MuiPaper-root": {
|
||||||
padding: 8,
|
padding: 8,
|
||||||
|
@ -143,7 +143,7 @@ export interface MiniDialogAttributes {
|
|||||||
buttonDirection?: "row" | "column";
|
buttonDirection?: "row" | "column";
|
||||||
}
|
}
|
||||||
|
|
||||||
type MiniDialogProps = Omit<DialogProps, "onClose"> & {
|
type MiniDialogProps = Pick<DialogProps, "open" | "sx"> & {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
attributes?: MiniDialogAttributes;
|
attributes?: MiniDialogAttributes;
|
||||||
};
|
};
|
||||||
@ -158,7 +158,7 @@ type MiniDialogProps = Omit<DialogProps, "onClose"> & {
|
|||||||
*/
|
*/
|
||||||
export const AttributedMiniDialog: React.FC<
|
export const AttributedMiniDialog: React.FC<
|
||||||
React.PropsWithChildren<MiniDialogProps>
|
React.PropsWithChildren<MiniDialogProps>
|
||||||
> = ({ open, onClose, attributes, children, ...props }) => {
|
> = ({ open, onClose, sx, attributes, children }) => {
|
||||||
const [phase, setPhase] = useState<
|
const [phase, setPhase] = useState<
|
||||||
"loading" | "secondary-loading" | "failed" | undefined
|
"loading" | "secondary-loading" | "failed" | undefined
|
||||||
>();
|
>();
|
||||||
@ -199,8 +199,6 @@ export const AttributedMiniDialog: React.FC<
|
|||||||
];
|
];
|
||||||
})(attributes.cancel);
|
})(attributes.cancel);
|
||||||
|
|
||||||
const { PaperProps, ...rest } = props;
|
|
||||||
|
|
||||||
const loadingButton = attributes.continue && (
|
const loadingButton = attributes.continue && (
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
loading={phase == "loading"}
|
loading={phase == "loading"}
|
||||||
@ -260,17 +258,14 @@ export const AttributedMiniDialog: React.FC<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
{...{ open, sx }}
|
||||||
|
onClose={handleClose}
|
||||||
fullWidth
|
fullWidth
|
||||||
PaperProps={{
|
slotProps={{
|
||||||
...PaperProps,
|
paper: {
|
||||||
sx: {
|
sx: { maxWidth: "360px" },
|
||||||
maxWidth: "360px",
|
|
||||||
...PaperProps?.sx,
|
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
onClose={handleClose}
|
|
||||||
{...rest}
|
|
||||||
>
|
>
|
||||||
{(attributes.icon ?? attributes.title) ? (
|
{(attributes.icon ?? attributes.title) ? (
|
||||||
<Stack
|
<Stack
|
||||||
@ -343,12 +338,18 @@ export const AttributedMiniDialog: React.FC<
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
type TitledMiniDialogProps = Omit<DialogProps, "onClose"> & {
|
type TitledMiniDialogProps = Pick<DialogProps, "open" | "sx"> & {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
/**
|
/**
|
||||||
* The dialog's title.
|
* The dialog's title.
|
||||||
*/
|
*/
|
||||||
title?: React.ReactNode;
|
title?: React.ReactNode;
|
||||||
|
/**
|
||||||
|
* Optional max width of the underlying MUI {@link Paper}.
|
||||||
|
*
|
||||||
|
* Default: 360px (same as {@link AttributedMiniDialog}).
|
||||||
|
*/
|
||||||
|
paperMaxWidth?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -366,27 +367,18 @@ type TitledMiniDialogProps = Omit<DialogProps, "onClose"> & {
|
|||||||
*/
|
*/
|
||||||
export const TitledMiniDialog: React.FC<
|
export const TitledMiniDialog: React.FC<
|
||||||
React.PropsWithChildren<TitledMiniDialogProps>
|
React.PropsWithChildren<TitledMiniDialogProps>
|
||||||
> = ({ open, onClose, title, children, ...props }) => {
|
> = ({ open, onClose, sx, paperMaxWidth, title, children }) => (
|
||||||
const { PaperProps, ...rest } = props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
{...{ open, sx }}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
fullWidth
|
fullWidth
|
||||||
PaperProps={{
|
slotProps={{
|
||||||
...PaperProps,
|
paper: { sx: { maxWidth: paperMaxWidth ?? "360px" } },
|
||||||
sx: {
|
|
||||||
maxWidth: "360px",
|
|
||||||
...PaperProps?.sx,
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
{...rest}
|
|
||||||
>
|
>
|
||||||
<DialogTitle sx={{ "&&&": { paddingBlock: "24px 16px" } }}>
|
<DialogTitle sx={{ "&&&": { paddingBlock: "24px 16px" } }}>
|
||||||
{title}
|
{title}
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent>{children}</DialogContent>
|
<DialogContent>{children}</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user