File size: 1,163 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
import { Button, Modal } from '@wordpress/components';
import { TranslateResult, useTranslate } from 'i18n-calypso';
import './styles.scss';
type ConfirmModalProps = {
isVisible: boolean;
cancelButtonLabel?: TranslateResult;
confirmButtonLabel?: TranslateResult;
text?: TranslateResult;
title: string;
onCancel: () => void;
onConfirm: () => void;
};
/**
* @deprecated Use ConfirmDialog instead to follow the new design system
*/
const ConfirmModal = ( {
isVisible,
cancelButtonLabel,
confirmButtonLabel,
text,
title,
onCancel,
onConfirm,
}: ConfirmModalProps ) => {
const translate = useTranslate();
if ( ! isVisible ) {
return null;
}
return (
<Modal overlayClassName="confirm-modal" title={ title } onRequestClose={ onCancel }>
{ text && <p className="confirm-modal__text">{ text }</p> }
<div className="confirm-modal__buttons">
<Button variant="tertiary" onClick={ onCancel }>
{ cancelButtonLabel ?? translate( 'Cancel' ) }
</Button>
<Button onClick={ onConfirm } variant="primary">
{ confirmButtonLabel ?? translate( 'Confirm' ) }
</Button>
</div>
</Modal>
);
};
export default ConfirmModal;
|