import "../css/Modal.css"

interface ModalProps {
  isOpen: boolean;
  onClose: () => void;
  message: string;
  confirmAction: () => void;
  cancelAction: () => void;
}

const Modal = ({ isOpen, onClose, message, confirmAction, cancelAction }: ModalProps) => {
  if (!isOpen) return null;

  return (
    <div className="modal-overlay" onClick={onClose}>
      <div className="modal-content" onClick={(e) => e.stopPropagation()}>
        <div className="modal-msg">
          <span aria-labelledby="message">{message}</span>
        </div>
        <div className="modal-buttons">
          <button onClick={confirmAction}>Yes, Delete</button>
          <button onClick={cancelAction}>Cancel</button>
        </div>
      </div>
    </div>
  );
};

export default Modal;
