diff --git a/website/assets/berlin.png b/website/assets/berlin.png deleted file mode 100644 index e01876f..0000000 Binary files a/website/assets/berlin.png and /dev/null differ diff --git a/website/assets/berlin.webp b/website/assets/berlin.webp deleted file mode 100644 index 397ff5e..0000000 Binary files a/website/assets/berlin.webp and /dev/null differ diff --git a/website/assets/favicon.ico b/website_astro/public/favicon.ico similarity index 100% rename from website/assets/favicon.ico rename to website_astro/public/favicon.ico diff --git a/website_astro/public/favicon.svg b/website_astro/public/favicon.svg deleted file mode 100644 index f157bd1..0000000 --- a/website_astro/public/favicon.svg +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/website/assets/map_howto.js b/website_astro/public/scripts/map.js similarity index 73% rename from website/assets/map_howto.js rename to website_astro/public/scripts/map.js index 90a6531..4c60107 100644 --- a/website/assets/map_howto.js +++ b/website_astro/public/scripts/map.js @@ -15,7 +15,7 @@ const berlin = { function initMap() { if (window.map) return - document.getElementById('mapbg-image').style.opacity = '0.2' + document.getElementById('mapbg-image').style.opacity = '0.5' const map = new maplibregl.Map({ style: 'https://tiles.openfreemap.org/styles/liberty', @@ -49,19 +49,7 @@ function initMap() { new maplibregl.Marker().setLngLat([-0.119, 51.507]).addTo(map) } -const mapDiv = document.getElementById('map-container') -mapDiv.onclick = function () { - initMap() -} - -// initMap() - -// let movedTo2d = false - -function selectStyle(event, style) { - initMap() - toggleButtonSelection(event.target) - +function selectStyle(style) { const styleUrl = 'https://tiles.openfreemap.org/styles/' + style.split('-')[0] map.setStyle(styleUrl) @@ -77,13 +65,22 @@ function selectStyle(event, style) { map.setZoom(berlin.zoom) } - document.getElementById('style-url-code').innerText = styleUrl + // document.getElementById('style-url-code').innerText = styleUrl } -function toggleButtonSelection(clickedButton) { - clickedButton.classList.add('selected') +// --- start - Array.from(clickedButton.parentElement.children) - .filter(child => child !== clickedButton) - .forEach(button => button.classList.remove('selected')) -} +const mapDiv = document.getElementById('map-container') +initMap() + +const buttons = document.querySelectorAll('.button-container .btn') + +buttons.forEach(button => { + button.addEventListener('click', function (event) { + buttons.forEach(button => button.classList.remove('selected')) + button.classList.add('selected') + + const style = event.target.getAttribute('data-style') + selectStyle(style) + }) +}) diff --git a/website_astro/src/components/Map.astro b/website_astro/src/components/Map.astro index a4ef5a8..02a38f6 100644 --- a/website_astro/src/components/Map.astro +++ b/website_astro/src/components/Map.astro @@ -2,6 +2,12 @@ --- +
Use the following style in a MapLibre map:
+https://tiles.openfreemap.org/styles/liberty
+
+Choose a style:
-Use the following style in a MapLibre map:
-https://tiles.openfreemap.org/styles/liberty
+You use OpenFreeMap by adding it to a website or mobile app.
+ + + + diff --git a/website_astro/src/layouts/Layout.astro b/website_astro/src/layouts/Layout.astro index 4ae47aa..6837990 100644 --- a/website_astro/src/layouts/Layout.astro +++ b/website_astro/src/layouts/Layout.astro @@ -20,15 +20,14 @@ import '../styles/global.css' /> + + - - - - + @@ -37,8 +36,8 @@ import '../styles/global.css'