22976abe92
- React 18 + Vite + TypeScript + Tailwind CSS setup - AppShell with Sidebar (plugin menu) + TopBar (tenant switcher, search, notifications, user menu) - Auth pages: Login, PasswordResetRequest, PasswordResetConfirm - Protected routes with auth guard - API client (axios with interceptors: session cookie, 401 redirect, 422 validation) - TanStack Query hooks for auth, users, companies, contacts, notifications - Zustand stores: authStore, uiStore - i18n setup (de/en locales) with react-i18next - UI component library: Button, Input, Select, Modal, Toast, Table, Card, Badge, Avatar, Pagination, EmptyState, Skeleton, ConfirmDialog - Accessibility: ARIA labels, 44px touch targets, keyboard nav, reduced-motion, sr-only - Design tokens from prototype as CSS custom properties - 111 tests passing across 20 test files - tsc --noEmit: 0 errors - npm run build: success (471KB JS, 24KB CSS)
43 lines
1.1 KiB
TypeScript
43 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;
|
|
}
|
|
|
|
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>
|
|
);
|
|
}
|