Last active
March 28, 2022 19:56
-
-
Save nautilor/43b8289ffde520a47b7a99b58d26d352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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