blob: 3388d670179371497cdc0f63dbc2620e521025f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import React, { Component } from 'react';
import { Map, TileLayer, Marker, Popup } from 'react-leaflet';
class MainMap extends Component {
state = {
lat: 51.505,
lng: -0.09,
zoom: 13,
}
render() {
const position = [this.state.lat, this.state.lng]
return (
<Map style={{height: this.props.height, width: this.props.width}} center={position} zoom={this.state.zoom}>
<TileLayer
attribution='© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="https://carto.com/attributions">CARTO</a>'
url="https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png" />
<Marker position={position}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</Map>
)
}
}
export default MainMap;
|