aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/helpers/higher-order-components/with-modal-props/with-modal-props.js
blob: aac6b5a616692efd6ed2814b646b21d412152411 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { connect } from 'react-redux'
import { hideModal } from '../../../store/actions'

const mapStateToProps = state => {
  const { appState } = state
  const { props: modalProps } = appState.modal.modalState

  return {
    ...modalProps,
  }
}

const mapDispatchToProps = dispatch => {
  return {
    hideModal: () => dispatch(hideModal()),
  }
}

export default function withModalProps (Component) {
  return connect(mapStateToProps, mapDispatchToProps)(Component)
}