Extend functionality of ConfirmButtons to have optional click outside behavior
parent
ea4cf58dc5
commit
2c845d678a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue