-
Notifications
You must be signed in to change notification settings - Fork 7
Refine UI Kit Place Details Compact sample #1055
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
base: main
Are you sure you want to change the base?
Conversation
|
Here is the summary of changes. You are about to add 4 region tags.
You are about to delete 4 region tags.
This comment is generated by snippet-bot.
|
| <gmp-place-details-compact orientation="horizontal"> | ||
| <!--[START maps_ui_kit_place_details_compact_request]--> | ||
| <div class="container"> | ||
| <!-- map-id is required to use advanced markers. See https://developers.google.com/maps/documentation/javascript/map-ids/mapid-over. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <!-- map-id is required to use advanced markers. See https://developers.google.com/maps/documentation/javascript/map-ids/mapid-over. --> | |
| <!-- map-id is required to use Advanced Markers. See https://developers.google.com/maps/documentation/javascript/map-ids/mapid-over. --> |
| The gmp-place-details-compact element is styled inline because it is | ||
| conditionally rendered and moved into the info window, which is | ||
| part of the map's shadow DOM. | ||
| --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| --> | |
| --> |
| <!-- map-id is required to use advanced markers. See https://developers.google.com/maps/documentation/javascript/map-ids/mapid-over. --> | ||
| <gmp-map | ||
| center="47.759737, -122.250632" | ||
| zoom="16" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest leaving off the center and zoom, as the fitBounds() call later will cover that (and that would avoid a transition post-load)
| 'maps' | ||
| )) as google.maps.MapsLibrary; | ||
| // Request needed libraries. | ||
| await Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| await Promise.all([ | |
| Promise.all([ |
I think we can tweak this to avoid strictly blocking on all these things up front
| )) as google.maps.MarkerLibrary; | ||
| gMap = new Map(mapContainer, { mapId: 'DEMO_MAP_ID' }); | ||
| marker = new AdvancedMarkerElement({ map: gMap }); | ||
| // Set the map options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Set the map options. | |
| await window.customElements.whenDefined('gmp-map'); | |
| // Set the map options. |
| placeDetailsRequest.place = event.placeId; | ||
| updateMapAndMarker(); | ||
| } else { | ||
| // Fire when the user clicks the map (not on a POI). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Fire when the user clicks the map (not on a POI). | |
| // When the user clicks the map (not on a POI). |
| if (event.placeId) { | ||
| console.log('clicked on POI'); | ||
| console.log(event.placeId); | ||
| // Fire when the user clicks a POI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // Fire when the user clicks a POI. | |
| // When the user clicks a POI. |
| } else { | ||
| // Fire when the user clicks the map (not on a POI). | ||
| console.log('No place was selected.'); | ||
| marker.style.display = 'none'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| marker.style.display = 'none'; |
| // Fire when the user clicks the map (not on a POI). | ||
| console.log('No place was selected.'); | ||
| marker.style.display = 'none'; | ||
| infoWindow.close(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| infoWindow.close(); |
should happen automatically because it's attached to the marker
| console.log(event.placeId); | ||
| // Fire when the user clicks a POI. | ||
| placeDetailsRequest.place = event.placeId; | ||
| updateMapAndMarker(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| updateMapAndMarker(); |
I think remove this here, and just let gmp-load on the details view trigger it?
No description provided.