Convert Modal component to Typescript
This commit is contained in:
1 parent
d79f9f5c84
commit
3c992d5df7
15 files changed
+24
-17
No files matched your search
@@ -1,16 +1,23 @@
|
||||
import { ReactNode, MouseEvent } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import styles from "./modal.module.css";
|
||||
import Button from "../button/button.tsx";
|
||||
import Button from "../button/button";
|
||||
|
||||
const Modal = ({ open, onClose, children, title }) => {
|
||||
interface ModalProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
children: ReactNode;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
const Modal = ({ open, onClose, children, title }: ModalProps) => {
|
||||
if (!open) return null;
|
||||
|
||||
const handleOverlayClick = () => {
|
||||
onClose();
|
||||
};
|
||||
|
||||
const handleModalClick = (e) => {
|
||||
const handleModalClick = (e: MouseEvent<HTMLDivElement>) => {
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user