mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 03:32:36 +08:00
feat: base-dialog: okBtn use LoadingButton
This commit is contained in:
parent
06121acfac
commit
f57c49ce3a
|
@ -8,6 +8,7 @@ import {
|
||||||
type SxProps,
|
type SxProps,
|
||||||
type Theme,
|
type Theme,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
import { LoadingButton } from "@mui/lab";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
title: ReactNode;
|
title: ReactNode;
|
||||||
|
@ -19,6 +20,7 @@ interface Props {
|
||||||
disableFooter?: boolean;
|
disableFooter?: boolean;
|
||||||
contentSx?: SxProps<Theme>;
|
contentSx?: SxProps<Theme>;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
|
loading?: boolean;
|
||||||
onOk?: () => void;
|
onOk?: () => void;
|
||||||
onCancel?: () => void;
|
onCancel?: () => void;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
|
@ -40,6 +42,7 @@ export const BaseDialog: React.FC<Props> = (props) => {
|
||||||
disableCancel,
|
disableCancel,
|
||||||
disableOk,
|
disableOk,
|
||||||
disableFooter,
|
disableFooter,
|
||||||
|
loading,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -56,9 +59,13 @@ export const BaseDialog: React.FC<Props> = (props) => {
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{!disableOk && (
|
{!disableOk && (
|
||||||
<Button variant="contained" onClick={props.onOk}>
|
<LoadingButton
|
||||||
|
loading={loading}
|
||||||
|
variant="contained"
|
||||||
|
onClick={props.onOk}
|
||||||
|
>
|
||||||
{okBtn}
|
{okBtn}
|
||||||
</Button>
|
</LoadingButton>
|
||||||
)}
|
)}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user