diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-02-16 08:09:16 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-02-16 08:09:16 +0800 |
commit | 6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf (patch) | |
tree | 47906b974dee789ffd544b4c85da67e6f2323016 /ui/app/components/loading.js | |
parent | 245e779f37763ce0633119c257877706d0bf3554 (diff) | |
parent | 943bcec0d702b2c70b323000ed25d3c425e2a44f (diff) | |
download | tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.gz tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.tar.zst tangerine-wallet-browser-6d103dc1e7eeb9a1f55e4387fcc1fe194c7eb4cf.zip |
Merge branch 'kumavis-patch-1' of github.com:MetaMask/metamask-plugin into kumavis-patch-1
Diffstat (limited to 'ui/app/components/loading.js')
-rw-r--r-- | ui/app/components/loading.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ui/app/components/loading.js b/ui/app/components/loading.js new file mode 100644 index 000000000..88dc535df --- /dev/null +++ b/ui/app/components/loading.js @@ -0,0 +1,50 @@ +const inherits = require('util').inherits +const Component = require('react').Component +const h = require('react-hyperscript') +const ReactCSSTransitionGroup = require('react-addons-css-transition-group') + + +inherits(LoadingIndicator, Component) +module.exports = LoadingIndicator + +function LoadingIndicator () { + Component.call(this) +} + +LoadingIndicator.prototype.render = function () { + const { isLoading, loadingMessage } = this.props + + return ( + h(ReactCSSTransitionGroup, { + className: 'css-transition-group', + transitionName: 'loader', + transitionEnterTimeout: 150, + transitionLeaveTimeout: 150, + }, [ + + isLoading ? h('div', { + style: { + zIndex: 10, + position: 'absolute', + display: 'flex', + justifyContent: 'center', + alignItems: 'center', + height: '100%', + width: '100%', + background: 'rgba(255, 255, 255, 0.5)', + }, + }, [ + h('img', { + src: 'images/loading.svg', + }), + + showMessageIfAny(loadingMessage), + ]) : null, + ]) + ) +} + +function showMessageIfAny (loadingMessage) { + if (!loadingMessage) return null + return h('span', loadingMessage) +} |