-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat(location-field): make location group order configurable #771
base: master
Are you sure you want to change the base?
Changes from 14 commits
7aed84c
4781771
f1e412b
992d76a
0c62fb1
6380c4c
8b1259f
6c0293a
8ee7f11
b83918d
6443942
d19c297
048c899
03c02ac
5f30a19
39cc6e7
e2b352e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -251,3 +251,22 @@ export const WithUserSettings = (): JSX.Element => ( | |
userLocationsAndRecentPlaces={userLocationsAndRecentPlaces} | ||
/> | ||
); | ||
|
||
export const WithCustomResultsOrder = (): JSX.Element => ( | ||
<LocationField | ||
currentPosition={currentPosition} | ||
geocoderConfig={geocoderConfig} | ||
getCurrentPosition={getCurrentPosition} | ||
preferredLayers={["example_layer"]} | ||
initialSearchResults={mockedGeocoderResponse.features} | ||
inputPlaceholder="Select from location" | ||
layerColorMap={layerColorMap} | ||
locationType="from" | ||
onLocationSelected={onLocationSelected} | ||
geocoderResultsOrder={["OTHER", "STATIONS", "STOPS"]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bit of a nit, but could we put the strings into an object so they're more consistent? Similar to how we do the view ids in otp-rr There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify where in OTP-RR to look for this? Also, we're using a lot of array methods here, what's the benefit of making this an object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lib/actions/ui-constants.js! Really this should be an enum but we can't do that in JS so an object with keys that are strings is the cleanest way to do it. Using an enum is good practice, prevents silly mistakes, and prevents us from having to copy paste strings aroudn There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in e2b352e! |
||
sortByDistance | ||
style={{ fontFamily: "sans-serif" }} | ||
/> | ||
); | ||
|
||
WithCustomResultsOrder.parameters = a11yOverrideParameters; |
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 assume this breaks the i18n string checks? Also we've spent a lot of effort and time elsewhere to not do this, are we ok with doing it here?
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 there's a way to skip any ids we're dynamically generating in the i18n check, but it doesn't feel worth it here so I passed the entire i18n id instead!