feat(web): add reusable ConfirmDialog and polish delete interactions
Extracts reusable ConfirmDialog component, refactors ship delete to show the ship name in confirmation, and improves interaction consistency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
35
web/src/components/ui/ConfirmDialog.tsx
Normal file
35
web/src/components/ui/ConfirmDialog.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import Modal from './Modal';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
onConfirm: () => void;
|
||||
title: string;
|
||||
message: string;
|
||||
confirmLabel?: string;
|
||||
danger?: boolean;
|
||||
}
|
||||
|
||||
export default function ConfirmDialog({
|
||||
open,
|
||||
onClose,
|
||||
onConfirm,
|
||||
title,
|
||||
message,
|
||||
confirmLabel = 'Confirm',
|
||||
danger = false,
|
||||
}: Props) {
|
||||
return (
|
||||
<Modal open={open} onClose={onClose} title={title}>
|
||||
<p style={{ margin: 'var(--spacing-md) 0', lineHeight: 1.5 }}>{message}</p>
|
||||
<div className="modal-actions">
|
||||
<button className="btn-secondary" onClick={onClose}>
|
||||
Cancel
|
||||
</button>
|
||||
<button className={danger ? 'btn-danger' : 'btn-primary'} onClick={onConfirm}>
|
||||
{confirmLabel}
|
||||
</button>
|
||||
</div>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user