6f1655785e
- mail.ts: add explicit types to decodeMimeHeader callback params - SessionList.tsx: use React.MouseEvent instead of nativeEvent - ComposeModal.tsx: construct name from first_name + last_name - MailDetail.tsx: destructure onReply/onForward from props - RichTextEditor.tsx: use SetContentOptions object instead of boolean - MailSearchBar.tsx: add optional value prop to interface - EmptyState.tsx: add optional children prop - Badge.tsx: add secondary variant to BadgeVariant, variantClasses, dotColors - ConfirmDialog.tsx: add optional children prop - hooks.ts: extend SearchResult type to include mail/file/event
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import React from 'react';
|
|
import { Modal } from './Modal';
|
|
import { Button } from './Button';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
export interface ConfirmDialogProps {
|
|
open: boolean;
|
|
title?: string;
|
|
message: string;
|
|
confirmLabel?: string;
|
|
cancelLabel?: string;
|
|
variant?: 'primary' | 'danger';
|
|
onConfirm: () => void;
|
|
onCancel: () => void;
|
|
children?: React.ReactNode;
|
|
}
|
|
|
|
export function ConfirmDialog({
|
|
open,
|
|
title,
|
|
message,
|
|
confirmLabel,
|
|
cancelLabel,
|
|
variant = 'primary',
|
|
onConfirm,
|
|
onCancel,
|
|
}: ConfirmDialogProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Modal open={open} onClose={onCancel} title={title || t('confirmDialog.title')} size="sm">
|
|
<p className="text-sm text-secondary-700">{message}</p>
|
|
<div className="mt-6 flex justify-end gap-3">
|
|
<Button variant="secondary" onClick={onCancel}>
|
|
{cancelLabel || t('confirmDialog.cancel')}
|
|
</Button>
|
|
<Button variant={variant === 'danger' ? 'danger' : 'primary'} onClick={onConfirm}>
|
|
{confirmLabel || t('confirmDialog.confirm')}
|
|
</Button>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}
|