aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/higher-order-components/with-modal-props/with-modal-props.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/higher-order-components/with-modal-props/with-modal-props.js')
-rw-r--r--ui/app/higher-order-components/with-modal-props/with-modal-props.js21
1 files changed, 21 insertions, 0 deletions
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)
+}