mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 12:43:11 +10:00
Extract the geocoding attribution to the geocoder file
This commit is contained in:
parent
98f4e49513
commit
f92c3bdeb2
3 changed files with 12 additions and 9 deletions
|
|
@ -1,5 +1,13 @@
|
|||
import React from 'react';
|
||||
import { getPlacePredictions, getPlaceDetails } from '../../util/googleMaps';
|
||||
|
||||
import css from './LocationAutocompleteInput.css';
|
||||
|
||||
// When displaying data from the Google Maps Places API, and
|
||||
// attribution is required next to the results.
|
||||
// See: https://developers.google.com/places/web-service/policies#powered
|
||||
export const GeocoderAttribution = () => <div className={css.poweredByGoogle} />;
|
||||
|
||||
/**
|
||||
* A forward geocoding (place name -> coordinates) implementation
|
||||
* using the Google Maps Places API.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ const placeBounds = prediction => {
|
|||
return null;
|
||||
};
|
||||
|
||||
export const GeocoderAttribution = () => null;
|
||||
|
||||
/**
|
||||
* A forward geocoding (place name -> coordinates) implementation
|
||||
* using the Mapbox Geocoding API.
|
||||
|
|
|
|||
|
|
@ -3,17 +3,10 @@ import { any, arrayOf, bool, func, number, shape, string, oneOfType, object } fr
|
|||
import classNames from 'classnames';
|
||||
import debounce from 'lodash/debounce';
|
||||
import { propTypes } from '../../util/types';
|
||||
import Geocoder from './GeocoderGoogleMaps';
|
||||
import Geocoder, { GeocoderAttribution } from './GeocoderGoogleMaps';
|
||||
|
||||
import css from './LocationAutocompleteInput.css';
|
||||
|
||||
// When using the Google Maps Places API for geocoding, a "Powered by
|
||||
// Google" logo should be shown next to the results. Turn this to
|
||||
// `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;
|
||||
|
||||
const DEBOUNCE_WAIT_TIME = 200;
|
||||
const KEY_CODE_ARROW_UP = 38;
|
||||
const KEY_CODE_ARROW_DOWN = 40;
|
||||
|
|
@ -94,7 +87,7 @@ const LocationPredictionsList = props => {
|
|||
return (
|
||||
<div className={classes}>
|
||||
<ul className={css.predictions}>{predictions.map(item)}</ul>
|
||||
{SHOW_POWERED_BY_GOOGLE ? <div className={css.poweredByGoogle} /> : null}
|
||||
<GeocoderAttribution />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue