Can delete multiple movements
This commit is contained in:
@ -9,7 +9,7 @@ import {
|
||||
import React, { PropsWithChildren } from "react";
|
||||
|
||||
type ConfirmContext = (
|
||||
message: string,
|
||||
message: string | React.ReactElement,
|
||||
title?: string,
|
||||
confirmButton?: string
|
||||
) => Promise<boolean>;
|
||||
@ -22,7 +22,7 @@ export function ConfirmDialogProvider(
|
||||
const [open, setOpen] = React.useState(false);
|
||||
|
||||
const [title, setTitle] = React.useState<string | undefined>(undefined);
|
||||
const [message, setMessage] = React.useState("");
|
||||
const [message, setMessage] = React.useState<string | React.ReactElement>("");
|
||||
const [confirmButton, setConfirmButton] = React.useState<string | undefined>(
|
||||
undefined
|
||||
);
|
||||
@ -53,13 +53,13 @@ export function ConfirmDialogProvider(
|
||||
|
||||
return (
|
||||
<>
|
||||
<ConfirmContextK value={hook}>
|
||||
{p.children}
|
||||
</ConfirmContextK>
|
||||
<ConfirmContextK value={hook}>{p.children}</ConfirmContextK>
|
||||
|
||||
<Dialog
|
||||
open={open}
|
||||
onClose={() => { handleClose(false); }}
|
||||
onClose={() => {
|
||||
handleClose(false);
|
||||
}}
|
||||
aria-labelledby="alert-dialog-title"
|
||||
aria-describedby="alert-dialog-description"
|
||||
onKeyUp={keyUp}
|
||||
@ -71,10 +71,20 @@ export function ConfirmDialogProvider(
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={() => { handleClose(false); }} autoFocus>
|
||||
<Button
|
||||
onClick={() => {
|
||||
handleClose(false);
|
||||
}}
|
||||
autoFocus
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={() => { handleClose(true); }} color="error">
|
||||
<Button
|
||||
onClick={() => {
|
||||
handleClose(true);
|
||||
}}
|
||||
color="error"
|
||||
>
|
||||
{confirmButton ?? "Confirm"}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
|
Reference in New Issue
Block a user