diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-09-18 01:12:31 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-09-20 05:31:10 +0800 |
commit | 3e470fee8a5560b605f7ad1060fb1eebafefd21e (patch) | |
tree | 5d1aa4b0636cf4a9d5c4d38eab9c667d64c2d7b3 | |
parent | 04ec3f0b6b3c66b8d75b7d3da257680a97453915 (diff) | |
download | tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar.gz tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar.bz2 tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar.lz tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar.xz tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.tar.zst tangerine-wallet-browser-3e470fee8a5560b605f7ad1060fb1eebafefd21e.zip |
Add withModalProps HOC
-rw-r--r-- | ui/app/higher-order-components/with-modal-props/index.js | 1 | ||||
-rw-r--r-- | ui/app/higher-order-components/with-modal-props/with-modal-props.js | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ui/app/higher-order-components/with-modal-props/index.js b/ui/app/higher-order-components/with-modal-props/index.js new file mode 100644 index 000000000..e476b51d2 --- /dev/null +++ b/ui/app/higher-order-components/with-modal-props/index.js @@ -0,0 +1 @@ +export { default } from './with-modal-props' diff --git a/ui/app/higher-order-components/with-modal-props/with-modal-props.js b/ui/app/higher-order-components/with-modal-props/with-modal-props.js new file mode 100644 index 000000000..02f3855af --- /dev/null +++ b/ui/app/higher-order-components/with-modal-props/with-modal-props.js @@ -0,0 +1,21 @@ +import { connect } from 'react-redux' +import { hideModal } from '../../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) +} |