芝麻web文件管理V1.00
编辑当前文件:/home/freeclou/optimyar/wp-content/plugins/code-snippets/js/components/common/ConfirmDialog.tsx
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}
{cancelLabel}
{confirmLabel}
: null