Initial commit: NestJS NextJS pnpm monorepo

This commit is contained in:
Marco_205 committed 2026-10-12 07:20:37 +00:00
commit 610dcf202b
175 files changed
+25172

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
"use client";
import { useEffect } from "react";
interface Props {
open: boolean;
onClose: () => void;
children: React.ReactNode;
}
export default function Modal({ open, onClose, children }: Props) {
// ESC-Taste schließen
useEffect(() => {
function handleEsc(e: KeyboardEvent) {
if (e.key === "Escape") onClose();
}
if (open) {
window.addEventListener("keydown", handleEsc);
}
return () => window.removeEventListener("keydown", handleEsc);
}, [open, onClose]);
if (!open) return null;
return (
<div style={overlayStyle} onClick={onClose}>
<div style={modalStyle} onClick={(e) => e.stopPropagation()}>
{children}
</div>
</div>
);
}
const overlayStyle = {
position: "fixed" as const,
inset: 0,
backgroundColor: "rgba(0,0,0,0.5)",
display: "flex",
justifyContent: "center",
alignItems: "center",
};
const modalStyle = {
backgroundColor: "white",
padding: "20px",
borderRadius: "8px",
minWidth: "300px",
};