@digitransit-component/digitransit-component-suggestion-item
v6.0.8
Published
digitransit-component suggestion-item module
Maintainers
Readme
@digitransit-component/digitransit-component-suggestion-item
STOP_STATUS_BADGE_IMGS
Maps each STOP_STATUS value to the sprite id of its corner badge icon.
getStopStatus
Resolves the stop status of a suggestion, based on the item's geocoding
addendum.GTFS metadata.
Parameters
itemobject a search suggestion item
Returns (string | null) a STOP_STATUS value, or null when no status applies
getStopBadge
Resolves the sprite id of the stop status badge shown on a suggestion's icon.
Parameters
itemobject a search suggestion item
Returns (string | null) a badge sprite id, or null when no badge applies
hasVehicleStationCode
Checks if stationId is a number. We don't want to display random hashes or names.
Parameters
stationIdstation's id, TODO we should probably support GBFS short_name
SuggestionItem
SuggestionItem renders suggestions for digitransit-autosuggest component.
Examples
<SuggestionItem
item={suggestionObject}
content={['Pysäkki', 'Kuusitie', 'Helsinki', 'H1923']}
loading={false}
showStopStatusMarkers={true}
stopStatusLabels={{ 'out-of-service': 'Stop out of service' }}
/>This module is part of the Digitransit-ui project. It is maintained in the HSLdevcom/digitransit-ui repository, where you can create PRs and issues.
Installation
Install this module individually:
$ npm install @digitransit-component/digitransit-component-suggestion-item