-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.js
71 lines (56 loc) · 1.44 KB
/
map.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
import {
MapContainer,
TileLayer,
useMap,
} from 'https://cdn.esm.sh/react-leaflet'
const cPosition = [55.9447956,-3.1875313]
const cDestination = [55.944433, -3.187893]
render(
<MapContainer center={cPosition} zoom={13} scrollWheelZoom={true}>
<TileLayer
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<Marker position={cPosition}>
<Popup>
Current Location.
</Popup>
</Marker>
<Marker position={cDestination}>
<Popup>
Nearest bin.
</Popup>
</Marker>
</MapContainer>
)
//
//class LikeButton extends React.Component {
// constructor(props) {
// super(props);
// this.state = { liked: false };
// }
//
// render() {
// if (this.state.liked) {
// return 'You liked comment number ' + this.props.commentID;
// }
//
// return e(
// 'button',
// { onClick: () => this.setState({ liked: true }) },
// 'Like'
// );
// }
//}
//
// Find all DOM containers, and render Like buttons into them.
document.querySelectorAll('.map_container')
.forEach(domContainer => {
// Read the comment ID from a data-* attribute.
const commentID = parseInt(domContainer.dataset.commentid, 10);
const root = ReactDOM.createRoot(domContainer);
root.render(
e(LikeButton, { commentID: commentID })
);
});