Skip to content

Instantly share code, notes, and snippets.

@nautilor
Last active March 28, 2022 19:56
Show Gist options
  • Save nautilor/43b8289ffde520a47b7a99b58d26d352 to your computer and use it in GitHub Desktop.
Save nautilor/43b8289ffde520a47b7a99b58d26d352 to your computer and use it in GitHub Desktop.
import React, { useState } from "react";
import { Marker } from "pigeon-maps";
import Modal from "react-modal";
import "./RouteModal.css";
export default function RouteModal(props) {
const [modal, setModal] = useState(false);
const toggleModal = () => {
setModal(!modal);
};
return (
<>
<Marker key={props.index} width={props.width} anchor={[props.lat, props.lng]} color={props.color} onClick={toggleModal} />
{(modal) && (
<Modal
isOpen={modal}
onRequestClose={toggleModal}
ariaHideApp={false}
>
<h2>{props.name}</h2>
<p>{props.name}</p>
<button onClick={toggleModal}>Close</button>
</Modal>
)}
</>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment