import React from 'react' import { __ } from '@wordpress/i18n' import { Button, Flex, Modal } from '@wordpress/components' import type { ReactNode } from 'react' export interface ConfirmDialogProps { open?: boolean title: string onConfirm?: VoidFunction onCancel: VoidFunction confirmLabel?: string cancelLabel?: string children?: ReactNode, confirmButtonClassName?: string } export const ConfirmDialog: React.FC = ({ open, title, onConfirm, onCancel, children, confirmLabel = __('OK', 'code-snippets'), cancelLabel = __('Cancel', 'code-snippets'), confirmButtonClassName }) => open ? { if ('Enter' === event.key) { onConfirm?.() } }} > {children} : null