-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue#24: Add a select form component for list of countries with auto…
…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`
- Loading branch information
1 parent
3bda54c
commit e5691d6
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | |
Mock server will run at [http://localhost:8080](http://localhost:8080). | ||
|
||
Default login: | ||
|
||
- email: [email protected] | ||
- password: vyaguta | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react'; | ||
import Select from 'react-select'; | ||
import PropTypes from 'prop-types'; | ||
|
||
/** | ||
* A select form component. | ||
* A selector component which is an abstraction overt React Select. | ||
* | ||
* @component | ||
* @example | ||
* return ( | ||
* <Selector | ||
* lists = the lists of data for the option | ||
* selected = the pre-selected item from the list | ||
* onChange = method invoked on selecting the item from the list. | ||
* /> | ||
* ) | ||
* | ||
* @param props | ||
*/ | ||
const Selector = props => { | ||
return <Select options={props.lists} value={props.selected} onChange={props.onChange} />; | ||
}; | ||
|
||
Selector.propTypes = { | ||
/** | ||
* The list of options for the selector. | ||
*/ | ||
lists: PropTypes.array, | ||
|
||
/** | ||
* The selected item from the list of items. | ||
*/ | ||
selected: PropTypes.object, | ||
/** | ||
* The handler method invoked when selecting the item from the list of items. | ||
*/ | ||
onChange: PropTypes.func, | ||
}; | ||
|
||
export default Selector; |