aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modals/notification
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-06-03 17:16:45 +0800
committerDan <danjm.com@gmail.com>2018-06-03 17:16:45 +0800
commit8f0a3b83111a9ccf5d515cebbd33cabe9ab16ba7 (patch)
tree5ab993280fa87add44aad288f155a0ce3b7a0da7 /ui/app/components/modals/notification
parent0f3480a97f2924de899e49a095ef24b9fa5506f1 (diff)
parent72dde75e58b2aaec22e41b2fe742bee7e9c35777 (diff)
downloadtangerine-wallet-browser-8f0a3b83111a9ccf5d515cebbd33cabe9ab16ba7.tar.gz
tangerine-wallet-browser-8f0a3b83111a9ccf5d515cebbd33cabe9ab16ba7.tar.zst
tangerine-wallet-browser-8f0a3b83111a9ccf5d515cebbd33cabe9ab16ba7.zip
Merge branch 'develop' into handle-import-account-failure-in-ui
Diffstat (limited to 'ui/app/components/modals/notification')
-rw-r--r--ui/app/components/modals/notification/index.js2
-rw-r--r--ui/app/components/modals/notification/notification.component.js30
-rw-r--r--ui/app/components/modals/notification/notification.container.js38
3 files changed, 70 insertions, 0 deletions
diff --git a/ui/app/components/modals/notification/index.js b/ui/app/components/modals/notification/index.js
new file mode 100644
index 000000000..d60a3129b
--- /dev/null
+++ b/ui/app/components/modals/notification/index.js
@@ -0,0 +1,2 @@
+import Notification from './notification.container'
+module.exports = Notification
diff --git a/ui/app/components/modals/notification/notification.component.js b/ui/app/components/modals/notification/notification.component.js
new file mode 100644
index 000000000..1af2f3ca8
--- /dev/null
+++ b/ui/app/components/modals/notification/notification.component.js
@@ -0,0 +1,30 @@
+import React from 'react'
+import PropTypes from 'prop-types'
+import Button from '../../button'
+
+const Notification = (props, context) => {
+ return (
+ <div className="modal-container">
+ { props.children }
+ <div className="modal-container__footer">
+ <Button
+ type="primary"
+ onClick={() => props.onHide()}
+ >
+ { context.t('ok') }
+ </Button>
+ </div>
+ </div>
+ )
+}
+
+Notification.propTypes = {
+ onHide: PropTypes.func.isRequired,
+ children: PropTypes.element,
+}
+
+Notification.contextTypes = {
+ t: PropTypes.func,
+}
+
+export default Notification
diff --git a/ui/app/components/modals/notification/notification.container.js b/ui/app/components/modals/notification/notification.container.js
new file mode 100644
index 000000000..5b98714da
--- /dev/null
+++ b/ui/app/components/modals/notification/notification.container.js
@@ -0,0 +1,38 @@
+import { connect } from 'react-redux'
+import Notification from './notification.component'
+
+const { hideModal } = require('../../../actions')
+
+const mapStateToProps = state => {
+ const { appState: { modal: { modalState: { props } } } } = state
+ const { onHide } = props
+ return {
+ onHide,
+ }
+}
+
+const mapDispatchToProps = dispatch => {
+ return {
+ hideModal: () => dispatch(hideModal()),
+ }
+}
+
+const mergeProps = (stateProps, dispatchProps, ownProps) => {
+ const { onHide, ...otherStateProps } = stateProps
+ const { hideModal, ...otherDispatchProps } = dispatchProps
+
+ return {
+ ...otherStateProps,
+ ...otherDispatchProps,
+ ...ownProps,
+ onHide: () => {
+ hideModal()
+
+ if (onHide && typeof onHide === 'function') {
+ onHide()
+ }
+ },
+ }
+}
+
+export default connect(mapStateToProps, mapDispatchToProps, mergeProps)(Notification)