Skip to content
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

Issue#24: Add a select form component for list of countries with autocomplete. #28

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

NadeemShakya
Copy link
Contributor

@NadeemShakya NadeemShakya commented May 4, 2020

Description

The select form contains a generic list of the country names.
This PR resolves#24

Summary of changes

  • Add CountrySelector component which gives a select form with list of all the country names with autocomplete functionality
  • Uses react-select component with react-select-country-list

@NadeemShakya NadeemShakya self-assigned this May 4, 2020
package.json Outdated
@@ -25,6 +26,7 @@
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"react-select": "^3.1.0",
"react-select-country-list": "^2.1.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not keep this as a dependency. Only the essentials used in every single app should be in this repo.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually these types of data regarding the list of counties usually come from a BE service and we fetch them once while bootstrapping the application and store them in redux store. Not sure why we need the list of countries.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we want to have the list of countries in FE then, its usually saved it in a JSON and then the file is lazily loaded. (as the content can be upto 4 to 5KB in size)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not keep this as a dependency. Only the essentials used in every single app should be in this repo.

Okay dai I've removed this package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually these types of data regarding the list of counties usually come from a BE service and we fetch them once while bootstrapping the application and store them in redux store. Not sure why we need the list of countries.

Thanks dai Got it

*
* @param props
*/
const CountrySelector = props => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a generic CountrySelector, create a generic Select component that accepts data as a prop so that it can be used for multiple select components.
Basically it should be an abstraction over React Select.

Think of it this way, if we ever need to replace React Select with another library, only this particular file should have modifications while our entire app should work with the same Select component.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@pratishshr
Copy link
Contributor

pratishshr commented May 5, 2020

@NadeemShakya Also a side note. Use closes or resolves keyword in the description for automatically linking an issue instead of using addresses.
https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@NadeemShakya NadeemShakya force-pushed the issue#24 branch 2 times, most recently from 82855e4 to b51b127 Compare May 18, 2020 03:55
…complete.

- [x] Add `CountrySelector` component which gives a select form with list of all the country names with autocomplete functionality
- [x] Uses `react-select` component with `react-select-country-list`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants