diff options
Diffstat (limited to 'client/src/map.js')
| -rw-r--r-- | client/src/map.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/client/src/map.js b/client/src/map.js new file mode 100644 index 0000000..10f2d66 --- /dev/null +++ b/client/src/map.js @@ -0,0 +1,41 @@ +import { fetchAttractions } from "./functions.js" +import { ParkArticle } from "./templateImplementations.js" + +// replace "toner" here with "terrain" or "watercolor" +var layer = new L.StamenTileLayer("watercolor"); +var map = new L.Map("discoverablemap", { + center: new L.LatLng(52.1026406, 5.175044799999999), + zoom: 10 +}); +map.addLayer(layer); + +function addMarkersForAttractions(map) { + return function addMarkers(attractions) { + for (let i = 0; i < attractions.length; i++) { + const attraction = attractions[i]; + const location = attraction.location; + + const marker = L.marker([location.lat, location.lon]).addTo(map); + + const articleObj = new ParkArticle(attraction, document.querySelector("parkpopup")) + console.log(articleObj) + const parkArticleFunctionality = { + orderButtonClick: orderButtonClicked, + displayTotal: displayTotal, + disableButton: disableButton, + } + const articleHTML = articleObj.toHTML(parkArticleFunctionality); + console.log(articleHTML); + + + marker.bindPopup( + articleHTML + ) + + } + } +} + + + fetchAttractions() + .then(addMarkersForAttractions(map)); |
