mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
9c4eefcdbf
* Add prettier for examples directory * Fix files * Fix linting * Add prettier script in case it has to be ran again
42 lines
1,019 B
JavaScript
42 lines
1,019 B
JavaScript
import React, { Component } from 'react'
|
|
import { FormGroup, ControlLabel, FormControl } from 'react-bootstrap'
|
|
import { connect } from 'react-redux'
|
|
import { bindActionCreators } from 'redux'
|
|
|
|
import { inputChange } from '../actions'
|
|
|
|
class Input extends Component {
|
|
inputChange = e => {
|
|
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)
|
|
}
|
|
}
|
|
|
|
export default connect(
|
|
null,
|
|
mapDispatchToProps
|
|
)(Input)
|