-
-
-
-
- Edit Comment
-
-
-
- No change detected
-
+
+
-
+
+
+
+
+
+ No change detected
+
+
);
}
diff --git a/src/components/ui/Modal.tsx b/src/components/ui/Modal.tsx
new file mode 100644
index 0000000..5a8a36c
--- /dev/null
+++ b/src/components/ui/Modal.tsx
@@ -0,0 +1,87 @@
+import { Show, onMount, onCleanup, type JSX } from "solid-js";
+import { Portal } from "solid-js/web";
+import Xmark from "~/components/icons/Xmark";
+
+export interface ModalProps {
+ /** Controls modal visibility */
+ open: boolean;
+ /** Callback when modal should close */
+ onClose: () => void;
+ /** Modal title (optional) */
+ title?: string | JSX.Element;
+ /** Modal content */
+ children: JSX.Element;
+ /** Action buttons (optional) */
+ actions?: JSX.Element;
+ /** Additional CSS classes for modal container */
+ class?: string;
+}
+
+export default function Modal(props: ModalProps) {
+ const handleBackdropClick = (e: MouseEvent) => {
+ if (e.target === e.currentTarget) {
+ props.onClose();
+ }
+ };
+
+ const handleEscapeKey = (e: KeyboardEvent) => {
+ if (e.key === "Escape") {
+ props.onClose();
+ }
+ };
+
+ onMount(() => {
+ if (props.open) {
+ document.addEventListener("keydown", handleEscapeKey);
+ }
+ });
+
+ onCleanup(() => {
+ document.removeEventListener("keydown", handleEscapeKey);
+ });
+
+ return (
+
+
+
+
e.stopPropagation()}
+ >
+
+
+
+
+ {props.title}
+
+
+
+
{props.children}
+
+
+ {props.actions}
+
+
+
+
+
+ );
+}
+
+export { Modal };
diff --git a/src/types/comment.ts b/src/types/comment.ts
index b058719..6b4b78d 100644
--- a/src/types/comment.ts
+++ b/src/types/comment.ts
@@ -176,6 +176,7 @@ export interface ReactionBarProps {
}
export interface CommentDeletionPromptProps {
+ isOpen: boolean;
privilegeLevel: PrivilegeLevel;
commentID: number;
commenterID: string;
@@ -192,6 +193,7 @@ export interface CommentDeletionPromptProps {
}
export interface EditCommentModalProps {
+ isOpen: boolean;
commentID: number;
commentBody: string;
editComment: (body: string, comment_id: number) => Promise
;