## Button Component System - Create dedicated components/ui/buttons directory with 6 specialized button components: - Button.tsx: Universal button with variants (primary, secondary, danger, link) and sizes - ActionButton.tsx: Action buttons matching existing patterns - BackButton.tsx: Navigation back buttons - CancelLink.tsx: Cancel/link style buttons - CloseButton.tsx: Modal/preview close buttons with variants - NavigationButton.tsx: Presentation navigation buttons - Update key components to use new button system (SlideEditor, ContentEditor, Modal, AlertDialog, ConfirmDialog) - Replace inline styled-jsx with proper CSS files for AlertDialog and ConfirmDialog ## Barrel Export Elimination - Remove all barrel export files violating IMPORT_STANDARDS.md: - src/themes/index.ts - src/components/themes/index.ts - src/components/presentations/index.ts - src/components/slide-editor/index.ts - Update 15+ files to use direct imports from themeLoader.ts instead of barrel exports - Fix function naming conflict in ThemeDetailPage.tsx (loadTheme shadowing) - Follow project standards: direct imports with .tsx extensions for better Vite performance ## Benefits - Improved Vite tree shaking and module resolution performance - Consistent, reusable button system across application - Adherence to project coding standards and import conventions - Reduced bundle size through elimination of barrel export overhead 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
101 lines
2.1 KiB
TypeScript
101 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
import { Modal } from './Modal.tsx';
|
|
import { Button } from './buttons/Button.tsx';
|
|
import './ConfirmDialog.css';
|
|
|
|
interface ConfirmDialogProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
onConfirm: () => void;
|
|
title?: string;
|
|
message: string;
|
|
type?: 'info' | 'warning' | 'danger';
|
|
confirmText?: string;
|
|
cancelText?: string;
|
|
isDestructive?: boolean;
|
|
}
|
|
|
|
export const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
isOpen,
|
|
onClose,
|
|
onConfirm,
|
|
title,
|
|
message,
|
|
type = 'info',
|
|
confirmText,
|
|
cancelText = 'Cancel',
|
|
isDestructive = false
|
|
}) => {
|
|
const getIcon = () => {
|
|
switch (type) {
|
|
case 'danger':
|
|
return '⚠️';
|
|
case 'warning':
|
|
return '⚠️';
|
|
default:
|
|
return '❓';
|
|
}
|
|
};
|
|
|
|
const getTitle = () => {
|
|
if (title) return title;
|
|
|
|
switch (type) {
|
|
case 'danger':
|
|
return 'Confirm Deletion';
|
|
case 'warning':
|
|
return 'Confirm Action';
|
|
default:
|
|
return 'Confirm';
|
|
}
|
|
};
|
|
|
|
const getConfirmText = () => {
|
|
if (confirmText) return confirmText;
|
|
|
|
switch (type) {
|
|
case 'danger':
|
|
return 'Delete';
|
|
case 'warning':
|
|
return 'Continue';
|
|
default:
|
|
return 'Confirm';
|
|
}
|
|
};
|
|
|
|
const handleConfirm = () => {
|
|
onConfirm();
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<Modal
|
|
isOpen={isOpen}
|
|
onClose={onClose}
|
|
size="small"
|
|
title={getTitle()}
|
|
closeOnOverlayClick={false}
|
|
>
|
|
<div className="confirm-dialog">
|
|
<div className="confirm-content">
|
|
<div className="confirm-icon">{getIcon()}</div>
|
|
<p className="confirm-message">{message}</p>
|
|
</div>
|
|
<div className="confirm-actions">
|
|
<Button
|
|
variant="secondary"
|
|
onClick={onClose}
|
|
>
|
|
{cancelText}
|
|
</Button>
|
|
<Button
|
|
variant={isDestructive || type === 'danger' ? 'danger' : 'primary'}
|
|
onClick={handleConfirm}
|
|
>
|
|
{getConfirmText()}
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
);
|
|
}; |