Extend functionality of ConfirmButtons to have optional click outside behavior

pull/10616/head
Alex P 2017-11-08 19:31:06 -08:00
parent ea4cf58dc5
commit 2c845d678a
1 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,8 @@
import React, {PropTypes, Component} from 'react'
import classnames from 'classnames'
import OnClickOutside from 'shared/components/OnClickOutside'
class ConfirmButtons extends Component {
constructor(props) {
super(props)
@ -14,6 +16,10 @@ class ConfirmButtons extends Component {
this.props.onCancel(item)
}
handleClickOutside = () => {
this.props.onClickOutside(this.props.item)
}
render() {
const {item, buttonSize, isDisabled} = this.props
@ -50,9 +56,11 @@ ConfirmButtons.propTypes = {
onCancel: func.isRequired,
buttonSize: string,
isDisabled: bool,
onClickOutside: func,
}
ConfirmButtons.defaultProps = {
buttonSize: 'btn-sm',
onClickOutside: () => {},
}
export default ConfirmButtons
export default OnClickOutside(ConfirmButtons)