-
Notifications
You must be signed in to change notification settings - Fork 7
Update Places UI Kit Nearby Search demo #824
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
Conversation
|
Here is the summary of changes. You are about to add 2 region tags.
You are about to delete 2 region tags.
This comment is generated by snippet-bot.
|
willum070
left a comment
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.
Nice work! Don't forget to add show_ts=false in your js_sample macro tag.
| <option value="restaurant">Restaurant</option> | ||
| <option value="electric_vehicle_charging_station" | ||
| >EV charging station</option | ||
| > |
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.
minor: formatting of the >
| </div> | ||
| <div class="list-container"> | ||
| <gmp-place-search orientation="vertical" selectable> | ||
| <gmp-place-all-content> </gmp-place-all-content> |
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.
| <gmp-place-all-content> </gmp-place-all-content> | |
| <gmp-place-all-content></gmp-place-all-content> |
| <script type="module" src="./index.js"></script> | ||
| <script> | ||
| (g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))}) | ||
| ({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"}); |
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.
fwiw v=weekly is the default. it's not a required apart. though I do notice all our demos seem to include it. I'm not sure if that's an intentional choice or not?
| </div> | ||
| </gmp-map> | ||
| <gmp-map center="-37.813,144.963" zoom="16" map-id="DEMO_MAP_ID"></gmp-map> | ||
| <div class="controls"> |
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.
I'm seeing a really big change here - the controls are no longer inside the <gmp-map>, no longer using our official slot="control-*" API
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.
... that said, looking more at this demo I'm thinking it would actually be better for this to move outside the map (both structurally, and visually). see later comment on this.
| <gmp-map center="-37.813,144.963" zoom="16" map-id="DEMO_MAP_ID"></gmp-map> | ||
| <div class="controls"> | ||
| <select name="types" class="type-select"> | ||
| <option value="">Select a place type</option> |
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.
I would highly recommend not having this blank option, and instead default to a real option - that way the demo shows the API without user interaction.
| gMap.panTo(pos); | ||
| gMap.setZoom(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.
this could be set off the gmp-map directly instead of the .innerMap
| ); | ||
| } else { | ||
| console.log("Your browser doesn't support geolocation"); | ||
| gMap.setZoom(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.
ditto, direct on gmp-map
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.
I'll come back to this file later -I suspect a lot of changes here as the other comments are addressed.
| placeDetailsPopup.position = place.location; | ||
| placeDetailsPopup.map = gMap; | ||
|
|
||
| gMap.fitBounds(place.viewport, {top: 0, left: 400}); |
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.
fwiw, the IW API will autopen when the IW opens. this line can go away with that change
| </gmp-map> | ||
| <gmp-map center="-37.813,144.963" zoom="16" map-id="DEMO_MAP_ID"></gmp-map> | ||
| <div class="controls"> | ||
| <select name="types" class="type-select"> |
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.
| <select name="types" class="type-select"> | |
| <select class="type-select"> |
I don't think name is doing anything in this demo?
Revised in accordance with demo style guidelines and updated loader version to "weekly"