Remove arrow functions from props in ConfirmButtons

pull/1887/head
Andrew Watkins 2017-08-16 12:43:50 -07:00
parent 546ebbbbbf
commit 0692f41682
1 changed files with 41 additions and 22 deletions

View File

@ -1,27 +1,46 @@
import React, {PropTypes} from 'react'
import React, {PropTypes, Component} from 'react'
import classnames from 'classnames'
const ConfirmButtons = ({onConfirm, item, onCancel, buttonSize, isDisabled}) =>
<div className="confirm-buttons">
<button
className={classnames('btn btn-info btn-square', {
[buttonSize]: buttonSize,
})}
onClick={() => onCancel(item)}
>
<span className="icon remove" />
</button>
<button
className={classnames('btn btn-success btn-square', {
[buttonSize]: buttonSize,
})}
disabled={isDisabled}
title={isDisabled ? 'Cannot Save' : 'Save'}
onClick={() => onConfirm(item)}
>
<span className="icon checkmark" />
</button>
</div>
class ConfirmButtons extends Component {
constructor(props) {
super(props)
}
handleConfirm = item => () => {
this.props.onConfirm(item)
}
handleCancel = item => () => {
this.props.onCancel(item)
}
render() {
const {item, buttonSize, isDisabled} = this.props
return (
<div className="confirm-buttons">
<button
className={classnames('btn btn-info btn-square', {
[buttonSize]: buttonSize,
})}
onClick={this.handleCancel(item)}
>
<span className="icon remove" />
</button>
<button
className={classnames('btn btn-success btn-square', {
[buttonSize]: buttonSize,
})}
disabled={isDisabled}
title={isDisabled ? 'Cannot Save' : 'Save'}
onClick={this.handleConfirm(item)}
>
<span className="icon checkmark" />
</button>
</div>
)
}
}
const {func, oneOfType, shape, string, bool} = PropTypes