Added "info" variant for Action Dialog
Info messages should not require any kind of confirmation, so I added option to disable ConfirmButton by providing "info" as a variant
This commit is contained in:
parent
1480a4478c
commit
d0422323ba
1 changed files with 17 additions and 15 deletions
|
@ -33,7 +33,7 @@ interface ActionDialogProps extends DialogProps {
|
||||||
confirmButtonState: ConfirmButtonTransitionState;
|
confirmButtonState: ConfirmButtonTransitionState;
|
||||||
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | false;
|
maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | false;
|
||||||
title: string;
|
title: string;
|
||||||
variant?: "default" | "delete";
|
variant?: "default" | "delete" | "info";
|
||||||
onConfirm();
|
onConfirm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,20 +61,22 @@ const ActionDialog: React.FC<ActionDialogProps> = props => {
|
||||||
<Button onClick={onClose}>
|
<Button onClick={onClose}>
|
||||||
<FormattedMessage {...buttonMessages.back} />
|
<FormattedMessage {...buttonMessages.back} />
|
||||||
</Button>
|
</Button>
|
||||||
<ConfirmButton
|
{variant !== "info" && (
|
||||||
transitionState={confirmButtonState}
|
<ConfirmButton
|
||||||
color="primary"
|
transitionState={confirmButtonState}
|
||||||
variant="contained"
|
color="primary"
|
||||||
onClick={onConfirm}
|
variant="contained"
|
||||||
className={classNames({
|
onClick={onConfirm}
|
||||||
[classes.deleteButton]: variant === "delete"
|
className={classNames({
|
||||||
})}
|
[classes.deleteButton]: variant === "delete"
|
||||||
>
|
})}
|
||||||
{confirmButtonLabel ||
|
>
|
||||||
(variant === "delete"
|
{confirmButtonLabel ||
|
||||||
? intl.formatMessage(buttonMessages.delete)
|
(variant === "delete"
|
||||||
: intl.formatMessage(buttonMessages.confirm))}
|
? intl.formatMessage(buttonMessages.delete)
|
||||||
</ConfirmButton>
|
: intl.formatMessage(buttonMessages.confirm))}
|
||||||
|
</ConfirmButton>
|
||||||
|
)}
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue