mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-31 02:26:50 +10:00
Move default predictions out of the geocoder files
This commit is contained in:
parent
95019872c2
commit
dc3cfcdc7d
3 changed files with 12 additions and 24 deletions
|
|
@ -8,15 +8,6 @@ import css from './LocationAutocompleteInput.css';
|
||||||
|
|
||||||
export const CURRENT_LOCATION_ID = 'current-location';
|
export const CURRENT_LOCATION_ID = 'current-location';
|
||||||
|
|
||||||
// A list of default predictions that can be shown when the user
|
|
||||||
// focuses on the autocomplete input without typing a search. This can
|
|
||||||
// be used to reduce typing and Geocoding API calls for common
|
|
||||||
// searches.
|
|
||||||
export const defaultPredictions = (config.maps.search.suggestCurrentLocation
|
|
||||||
? [{ id: CURRENT_LOCATION_ID, predictionPlace: {} }]
|
|
||||||
: []
|
|
||||||
).concat(config.maps.search.defaults);
|
|
||||||
|
|
||||||
// When displaying data from the Google Maps Places API, and
|
// When displaying data from the Google Maps Places API, and
|
||||||
// attribution is required next to the results.
|
// attribution is required next to the results.
|
||||||
// See: https://developers.google.com/places/web-service/policies#powered
|
// See: https://developers.google.com/places/web-service/policies#powered
|
||||||
|
|
|
||||||
|
|
@ -33,15 +33,6 @@ const placeBounds = prediction => {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A list of default predictions that can be shown when the user
|
|
||||||
// focuses on the autocomplete input without typing a search. This can
|
|
||||||
// be used to reduce typing and Geocoding API calls for common
|
|
||||||
// searches.
|
|
||||||
export const defaultPredictions = (config.maps.search.suggestCurrentLocation
|
|
||||||
? [{ id: CURRENT_LOCATION_ID, predictionPlace: {} }]
|
|
||||||
: []
|
|
||||||
).concat(config.maps.search.defaults);
|
|
||||||
|
|
||||||
export const GeocoderAttribution = () => null;
|
export const GeocoderAttribution = () => null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,21 @@ import { IconSpinner } from '../../components';
|
||||||
import { propTypes } from '../../util/types';
|
import { propTypes } from '../../util/types';
|
||||||
import IconHourGlass from './IconHourGlass';
|
import IconHourGlass from './IconHourGlass';
|
||||||
import IconCurrentLocation from './IconCurrentLocation';
|
import IconCurrentLocation from './IconCurrentLocation';
|
||||||
import Geocoder, {
|
import Geocoder, { GeocoderAttribution, CURRENT_LOCATION_ID } from './GeocoderGoogleMaps';
|
||||||
GeocoderAttribution,
|
// import Geocoder, { GeocoderAttribution, CURRENT_LOCATION_ID } from './GeocoderMapbox';
|
||||||
defaultPredictions,
|
import config from '../../config';
|
||||||
CURRENT_LOCATION_ID,
|
|
||||||
} from './GeocoderGoogleMaps';
|
|
||||||
// import Geocoder, { GeocoderAttribution, defaultPredictions, CURRENT_LOCATION_ID } from './GeocoderMapbox';
|
|
||||||
|
|
||||||
import css from './LocationAutocompleteInput.css';
|
import css from './LocationAutocompleteInput.css';
|
||||||
|
|
||||||
|
// A list of default predictions that can be shown when the user
|
||||||
|
// focuses on the autocomplete input without typing a search. This can
|
||||||
|
// be used to reduce typing and Geocoding API calls for common
|
||||||
|
// searches.
|
||||||
|
export const defaultPredictions = (config.maps.search.suggestCurrentLocation
|
||||||
|
? [{ id: CURRENT_LOCATION_ID, predictionPlace: {} }]
|
||||||
|
: []
|
||||||
|
).concat(config.maps.search.defaults);
|
||||||
|
|
||||||
const DEBOUNCE_WAIT_TIME = 200;
|
const DEBOUNCE_WAIT_TIME = 200;
|
||||||
const KEY_CODE_ARROW_UP = 38;
|
const KEY_CODE_ARROW_UP = 38;
|
||||||
const KEY_CODE_ARROW_DOWN = 40;
|
const KEY_CODE_ARROW_DOWN = 40;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue