1 | import React from 'react'
|
2 |
|
3 | var AbcUiDropDown = React.createClass({
|
4 | render () {
|
5 | var contentList = this.props.contentList
|
6 | var selectElement = (
|
7 | <select ref="selectedItem"
|
8 | className="form-control"
|
9 | onChange={this.handleSelection}
|
10 | defaultValue={this.props.selectedItem}>
|
11 | {contentList.map(function (content) {
|
12 | return (<option value={content} key={content}>{content}</option>)
|
13 | })}
|
14 | </select>
|
15 | )
|
16 | return selectElement
|
17 | },
|
18 | handleSelection () {
|
19 | if (this.props.onUserChange) {
|
20 | this.props.onUserChange(this.refs.selectedItem.value)
|
21 | }
|
22 | },
|
23 | getValue () {
|
24 | return this.refs.selectedItem.value
|
25 | }
|
26 | })
|
27 |
|
28 | module.exports = AbcUiDropDown
|
29 |
|