Universal Disappearing Messages

This commit is contained in:
Fedor Indutny 2021-06-01 13:45:43 -07:00 committed by GitHub
parent c63871d71b
commit 19f8042cd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 1224 additions and 191 deletions

View file

@ -14,6 +14,7 @@ export type ActionSpec = {
};
export type OwnProps = {
readonly moduleClassName?: string;
readonly actions?: Array<ActionSpec>;
readonly cancelText?: string;
readonly children?: React.ReactNode;
@ -22,6 +23,7 @@ export type OwnProps = {
readonly onClose: () => unknown;
readonly title?: string | React.ReactNode;
readonly theme?: Theme;
readonly hasXButton?: boolean;
};
export type Props = OwnProps;
@ -48,6 +50,7 @@ function getButtonVariant(
export const ConfirmationDialog = React.memo(
({
moduleClassName,
actions = [],
cancelText,
children,
@ -56,6 +59,7 @@ export const ConfirmationDialog = React.memo(
onClose,
theme,
title,
hasXButton,
}: Props) => {
const cancelAndClose = React.useCallback(() => {
if (onCancel) {
@ -76,7 +80,14 @@ export const ConfirmationDialog = React.memo(
const hasActions = Boolean(actions.length);
return (
<Modal i18n={i18n} onClose={cancelAndClose} title={title} theme={theme}>
<Modal
moduleClassName={moduleClassName}
i18n={i18n}
onClose={cancelAndClose}
title={title}
theme={theme}
hasXButton={hasXButton}
>
{children}
<Modal.ButtonFooter>
<Button