Skip to content

Commit

Permalink
Merge pull request #9 from mprzodala/selectFieldFix
Browse files Browse the repository at this point in the history
Select field fix
  • Loading branch information
mprzodala authored Apr 10, 2017
2 parents da6028b + 713a1c9 commit 6183005
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Bootstrap.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Separate.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-components-form",
"version": "1.8.0",
"version": "1.8.1",
"description": "React form components",
"main": "main.js",
"jsnext:main": "src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/components/SelectField.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const SelectField = ({
>
{options.map(option => (
<option
value={option.value || option}
key={option.value || option}
value={option.label ? option.value : option}
key={option.label || option}
>
{option.label || option}
</option>
Expand Down
26 changes: 25 additions & 1 deletion src/demo/book/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ const personSchema = new Schema({
},
surname: {
type: String
},
age: {
type: String,
options: [
{
label: 'Select age range',
value: ''
},
{
label: '18-21',
value: '18-21'
},
{
label: '22-28',
value: '22-28'
},
{
label: '29-40',
value: '29-40'
}
]
}
});

Expand Down Expand Up @@ -84,9 +105,12 @@ const BookForm = () => (
<div className={objectFormField}>
<TextField name="name" placeholder="name"/>
</div>
<div>
<div className={objectFormField}>
<TextField name="surname" placeholder="surname"/>
</div>
<div>
<SelectField name="age" />
</div>
</ObjectField>
</ListField>
<ListField name="languages" label="Languages" className={listWrapper}>
Expand Down

0 comments on commit 6183005

Please sign in to comment.