2019-01-07 15:35:14 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { Modal, ModalBody, ModalHeader } from 'reactstrap';
|
|
|
|
import { Map, TileLayer, Marker, Popup } from 'react-leaflet';
|
|
|
|
import * as PropTypes from 'prop-types';
|
|
|
|
import './MapModal.scss';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
toggle: PropTypes.func,
|
|
|
|
isOpen: PropTypes.bool,
|
|
|
|
title: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
2019-01-07 21:43:25 +03:00
|
|
|
const MapModal = ({ toggle, isOpen, title }) => {
|
|
|
|
const madridLat = 40.416775;
|
|
|
|
const madridLong = -3.703790;
|
|
|
|
const latLong = [ madridLat, madridLong ];
|
2019-01-07 15:35:14 +03:00
|
|
|
|
2019-01-07 21:43:25 +03:00
|
|
|
return (
|
|
|
|
<Modal toggle={toggle} isOpen={isOpen} className="map-modal__modal" contentClassName="map-modal__modal-content">
|
|
|
|
<ModalHeader toggle={toggle}>{title}</ModalHeader>
|
|
|
|
<ModalBody className="map-modal__modal-body">
|
|
|
|
<Map center={latLong} zoom="13">
|
|
|
|
<TileLayer
|
|
|
|
attribution='&copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
|
|
|
|
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
|
|
/>
|
|
|
|
<Marker position={latLong}>
|
|
|
|
<Popup>
|
|
|
|
A pretty CSS3 popup. <br /> Easily customizable.
|
|
|
|
</Popup>
|
|
|
|
</Marker>
|
|
|
|
</Map>
|
|
|
|
</ModalBody>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
};
|
2019-01-07 15:35:14 +03:00
|
|
|
|
|
|
|
MapModal.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default MapModal;
|