aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/info-box/info-box.component.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-05-24 02:33:15 +0800
committerDan <danjm.com@gmail.com>2018-05-24 02:33:15 +0800
commit440905125d77d1d5d72d1aceac2940925a8ac38f (patch)
treed5418384983f9de8092d2dfdd1ddddec2ffd555e /ui/app/components/info-box/info-box.component.js
parent3dec7cb52443b24d6a24f75434ee41a54f4cfd0b (diff)
parented01c6c8264a860cdc4248991839954bdf22e2ef (diff)
downloadtangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.gz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.bz2
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.lz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.xz
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.tar.zst
tangerine-wallet-browser-440905125d77d1d5d72d1aceac2940925a8ac38f.zip
Merge branch 'develop' into i3725-refactor-send-component-
Diffstat (limited to 'ui/app/components/info-box/info-box.component.js')
-rw-r--r--ui/app/components/info-box/info-box.component.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/ui/app/components/info-box/info-box.component.js b/ui/app/components/info-box/info-box.component.js
new file mode 100644
index 000000000..8688b8e8f
--- /dev/null
+++ b/ui/app/components/info-box/info-box.component.js
@@ -0,0 +1,49 @@
+import React, { Component } from 'react'
+import PropTypes from 'prop-types'
+
+export default class InfoBox extends Component {
+ static contextTypes = {
+ t: PropTypes.func,
+ }
+
+ static propTypes = {
+ onClose: PropTypes.func,
+ title: PropTypes.string,
+ description: PropTypes.string,
+ }
+
+ constructor (props) {
+ super(props)
+
+ this.state = {
+ isShowing: true,
+ }
+ }
+
+ handleClose () {
+ const { onClose } = this.props
+
+ if (onClose) {
+ onClose()
+ } else {
+ this.setState({ isShowing: false })
+ }
+ }
+
+ render () {
+ const { title, description } = this.props
+
+ return !this.state.isShowing
+ ? null
+ : (
+ <div className="info-box">
+ <div
+ className="info-box__close"
+ onClick={() => this.handleClose()}
+ />
+ <div className="info-box__title">{ title }</div>
+ <div className="info-box__description">{ description }</div>
+ </div>
+ )
+ }
+}