-
Notifications
You must be signed in to change notification settings - Fork 943
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
Generic location autocomplete #893
Conversation
4e318f6
to
107328c
Compare
// `false` when using some other Geocoding API. Autocomplete | ||
// predictions dropdown bottom padding might need adjusting as well to | ||
// hide the space left for the logo. | ||
const SHOW_POWERED_BY_GOOGLE = true; |
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.
Would it be safer to use config.googleMapsAPIKey
check somehow here? Especially if we end up making mapbox our default map provider? (Missing to turn this on/off is a clear violation of their terms.)
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.
Even better would be that the whole div (or just the flag) is exported from Geocoder file.
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.
Could be better but a config var might make customisers think that it is enough to change the provider.
I think a config still makes sense, then we can already adjust the predictions list paddings etc. based on that. We just have to mention that some imports have to be changes too.
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 moved the attribution element to the geocoder.
However, the predictions list leaves bottom padding for the attribution, and that padding is added in many places. I added a global var that can be used to set the padding when the map provider is changed.
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.
Looks good 👍
Check the comments and grep for the country occurrences so that references to it won't be left around.
* [change] Removed the `country` parameter from the search page as it | ||
was not used anywhere. | ||
[#893](https://github.com/sharetribe/flex-template-web/pull/893) | ||
|
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.
The changelog could contain even multiple entries for this PR. At least for adding the Mapbox geocoder and maybe also a note about the generalization of the geocoder.
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.
Is it ok not to advertise it yet? It's not usable without the script imports, and it would be a violation of the service terms to use the Mapbox geocoder without also using the Mapbox map (which isn't finished). We'll have a big major release when all the parts are ready.
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.
Valid point. Let's add an entry when Mapbox can properly be taken into use.
The padding is set for the "Powered by Google" attribution, but that might not be present e.g. with Mapbox.
@@ -50,7 +50,7 @@ | |||
.predictionsRoot { | |||
position: absolute; | |||
width: 100%; | |||
padding-bottom: 98px; | |||
padding-bottom: var(--locationAutocompleteBottomPadding); |
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 think the larger padding here was for the Mobile Safari bottom spacing, but it looked fine with 72px when I tested it.
This PR generalises the
LocationAutocompleteInput
so that the geocoding implementation can be swapped.Two geocoder implementation are provided, one for Google Maps Places API (default) and one for Mapbox Geocoding API. The Mapbox geocoder requires
window.mapboxgl
andwindow.mapboxSdk
globals to be present.