-
Notifications
You must be signed in to change notification settings - Fork 96
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
Feature/new selector #3332
Feature/new selector #3332
Conversation
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.
wow Downshift!! Great choise @edbrett 😄
It only worries me that the dropdown component is so complex now. I've see that you are encapsulating some parts of the dropdown logic in differents functions. What do you think about make individual sub-components with that? That should be reduce quite the component complexity.
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.
We must remove this line: import 'react-select-me/lib/ReactSelectMe.css';
in app/javascript/pages/country/index.js
You are completely right! I will try to make it more modular :) |
Much better now! Thx @edbrett 👏 👏 |
The problem
We were using
react-select-me
, a selector library that handles the majority of use cases for a dropdown selector. This selector doesn't support keyboard events, and in order to add grouping and interaction to the options list we would need to do significant work to handle all the use cases.The solution
Thanks to the wonderful library Downshift we can now make truly flexible selectors, autocompletes, etc etc. Downshift gives us the control over the data returned, and we build the render. In this PR, I have created a
react-select
like dropdown using Downshift which accounts for all the edge cases that GFW requires:BONUS
Instead of using
./bin/server
you can now usenpm start
to start the serverDemo
Notes
This is a starting point. It would be good if we can work on improving this selector and any bugs you can find.