Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: improve google maps integration #191

Merged
merged 8 commits into from
Aug 7, 2024
Merged

Conversation

harlan-zw
Copy link
Collaborator

@harlan-zw harlan-zw commented Aug 6, 2024

πŸ”— Linked issue

#103
#187
#169
#83

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

The current implementation of Google Maps has some issues, this is due to how unclear API boundaries. We need a tighter coupling around shared map and a placeholder props, everything else needs to be exposed to end users so they can implement it themselves.

Docs will still need some work in the future.

πŸš€ Features

  • markers prop (string | AdvancedMapMarkerOptions)[]

Customize the markers displayed on the static map and the interactive map. Fully reactive.

<script lang="ts" setup>
const markers = [
	'-34.397,150.644', // provide a string as lng,lat 
   { position: { lng: -34.397, lat: 150.644 } } // OR provide an bject
]
</script>
<template>
  <ScriptGoogleMaps :markers="['-34.397,150.644', { position: { lng: -34.397, lat: 150.644 } }]" />
</template>
  • centerMarker prop boolean

Controls whether a marker is placed at the center position.

⚠️ Breaking Changes

  • options is renamed to mapOptions
  <ScriptGoogleMap
-    :options=""
+    :map-options=""
   />
  • query is renamed to center, it's now recommended to use {longitude},{latitude} rather than a text query.
  <ScriptGoogleMap
-    :query=""
+    :center=""
   />
  • The exposed internal API signature is now different.
<script lang="ts" setup>
const maps = ref()
onMounted(() => {
-  maps.value // google maps instance
+  maps.value // { googleMaps, map, createAdvancedMapMarker, resolveQueryToLatLang, importLibrary }
})
</script>
<template>
   <ScriptGoogleMap ref="maps" />
</template>

Copy link

vercel bot commented Aug 6, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
scripts-docs βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Aug 7, 2024 6:40am
scripts-playground βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Aug 7, 2024 6:40am

@harlan-zw harlan-zw marked this pull request as ready for review August 7, 2024 05:16
@harlan-zw harlan-zw changed the title feat: improve google maps integration feat!: improve google maps integration Aug 7, 2024
@harlan-zw harlan-zw merged commit b189d54 into main Aug 7, 2024
4 checks passed
@harlan-zw harlan-zw deleted the feat/google-map-improvements branch August 7, 2024 10:19
docs/components/content/GoogleMapsDemo.vue Show resolved Hide resolved
- $5 per 1000 loads for the Geocoding API
- $2 per 1000 loads for the Static Maps API
- $2 per 1000 loads for the Static Maps API - You can avoid providing a `placeholder` slot.
- $5 per 1000 loads for the Geocoding API - You can avoid this by providing a `google.maps.LatLng` object instead of a string for the `center` prop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: can we link to the source, where the amounts are coming from?
This might get outdated as time goes by, maybe we could add a disclaimer along the lines: "The example cost is based on this source. Actual cost may change. For more accurate cost estimation, please visit ... "

@harlan-zw harlan-zw mentioned this pull request Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants