-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: clean up debug messages replace esr with bun
- Loading branch information
1 parent
bcd70ab
commit 925c870
Showing
6 changed files
with
88 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
export interface Props { | ||
latitude: number | ||
longitude: number | ||
zoom: number | ||
mapStyle: string | ||
className?: string | ||
interactive?: boolean | ||
} | ||
const { latitude, longitude, zoom, mapStyle, className, interactive } = Astro.props | ||
--- | ||
|
||
<maplibre-map | ||
data-latitude={latitude} | ||
data-longitude={longitude} | ||
data-mapstyle={mapStyle} | ||
data-zoom={zoom} | ||
data-interactive={interactive} | ||
> | ||
<div id='map' class:list={[className]}></div> | ||
|
||
<link rel='stylesheet' href='https://unpkg.com/maplibre-gl/dist/maplibre-gl.css' /> | ||
</maplibre-map> | ||
<script> | ||
import maplibregl from 'maplibre-gl' | ||
class MapLibreMap extends HTMLElement { | ||
constructor() { | ||
super() | ||
|
||
const data = this.dataset | ||
console.log(data) | ||
new maplibregl.Map({ | ||
container: 'map', // container id | ||
style: this.dataset.mapstyle!, | ||
center: [parseFloat(this.dataset.longitude!), parseFloat(this.dataset.latitude!)], | ||
zoom: parseFloat(this.dataset.zoom!) | ||
// interactive: this.dataset.interactive! === 'true' | ||
}) | ||
} | ||
} | ||
|
||
window.customElements.define('maplibre-map', MapLibreMap) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters