feat(web): implement Ship List page with create and delete modals

Adds ship cards with navigation, create ship modal with initial stats,
inline delete confirmation, and supporting CSS for modals and cards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Bas van Rossem
2026-02-19 16:23:00 +01:00
parent 06428f79cd
commit 130cffd3c1
5 changed files with 360 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
import { useEffect, type ReactNode } from 'react';
interface ModalProps {
open: boolean;
onClose: () => void;
title: string;
children: ReactNode;
}
export default function Modal({ open, onClose, title, children }: ModalProps) {
useEffect(() => {
if (!open) return;
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', onKey);
return () => window.removeEventListener('keydown', onKey);
}, [open, onClose]);
if (!open) return null;
return (
<div className="modal-overlay" onClick={onClose}>
<div className="modal-content" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2 className="modal-title">{title}</h2>
<button className="btn-icon" onClick={onClose}>
&times;
</button>
</div>
{children}
</div>
</div>
);
}