2018-12-17 16:34:32 +00:00
|
|
|
import React, { Component } from 'react'
|
2017-09-19 19:24:28 +00:00
|
|
|
import { FormGroup, ControlLabel, FormControl } from 'react-bootstrap'
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
|
|
|
|
import { inputChange } from '../actions'
|
|
|
|
|
|
|
|
class Input extends Component {
|
2018-12-17 16:34:32 +00:00
|
|
|
inputChange = e => {
|
2017-09-19 19:24:28 +00:00
|
|
|
const { inputChange, title, name } = this.props
|
|
|
|
inputChange(title, name, e.target.value)
|
|
|
|
}
|
|
|
|
|
|
|
|
render () {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<FormGroup controlId='formBasicText'>
|
|
|
|
<ControlLabel>{this.props.controlLabel}</ControlLabel>
|
|
|
|
<FormControl
|
|
|
|
disabled={this.props.disabled}
|
|
|
|
type={this.props.type || 'Text'}
|
|
|
|
placeholder={this.props.controlLabel}
|
|
|
|
onChange={this.inputChange}
|
|
|
|
value={this.props.val}
|
|
|
|
/>
|
|
|
|
</FormGroup>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
|
|
|
inputChange: bindActionCreators(inputChange, dispatch)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 16:34:32 +00:00
|
|
|
export default connect(
|
|
|
|
null,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(Input)
|