diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-02-01 10:24:20 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-02-01 10:24:20 +0800 |
commit | 4f1fe1da6295902e3e0fee633444f84f61f28449 (patch) | |
tree | a8e35564ec7963c70cd61868323c202bdc7131dd /ui/app/components/wallet-view.js | |
parent | 0c6fef3dec4f3ba70e8e86275ee9db4f2d58d129 (diff) | |
parent | 78bce55858916ba9d3189f76db440768e6ae95b1 (diff) | |
download | tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.gz tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.bz2 tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.lz tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.xz tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.tar.zst tangerine-wallet-browser-4f1fe1da6295902e3e0fee633444f84f61f28449.zip |
Fix merge conflicts from uat-next
Diffstat (limited to 'ui/app/components/wallet-view.js')
-rw-r--r-- | ui/app/components/wallet-view.js | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js index c7f81a305..ce0902a91 100644 --- a/ui/app/components/wallet-view.js +++ b/ui/app/components/wallet-view.js @@ -4,8 +4,10 @@ const h = require('react-hyperscript') const { withRouter } = require('react-router-dom') const { compose } = require('recompose') const inherits = require('util').inherits +const classnames = require('classnames') const Identicon = require('./identicon') // const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns +const Tooltip = require('./tooltip-v2.js') const copyToClipboard = require('copy-to-clipboard') const actions = require('../actions') const BalanceComponent = require('./balance-component') @@ -51,6 +53,7 @@ function WalletView () { Component.call(this) this.state = { hasCopied: false, + copyToClipboardPressed: false, } } @@ -140,17 +143,30 @@ WalletView.prototype.render = function () { ]), ]), - - h('div.wallet-view__address', { - onClick: () => { - copyToClipboard(selectedAddress) - this.setState({ hasCopied: true }) - setTimeout(() => this.setState({ hasCopied: false }), 3000) - }, + h(Tooltip, { + position: 'bottom', + title: this.state.hasCopied ? 'Copied!' : 'Copy to clipboard', + wrapperClassName: 'wallet-view__tooltip', }, [ - this.state.hasCopied && 'Copied to Clipboard', - !this.state.hasCopied && `${selectedAddress.slice(0, 4)}...${selectedAddress.slice(-4)}`, - h('i.fa.fa-clipboard', { style: { marginLeft: '8px' } }), + h('button.wallet-view__address', { + className: classnames({ + 'wallet-view__address__pressed': this.state.copyToClipboardPressed, + }), + onClick: () => { + copyToClipboard(selectedAddress) + this.setState({ hasCopied: true }) + setTimeout(() => this.setState({ hasCopied: false }), 3000) + }, + onMouseDown: () => { + this.setState({ copyToClipboardPressed: true }) + }, + onMouseUp: () => { + this.setState({ copyToClipboardPressed: false }) + }, + }, [ + `${selectedAddress.slice(0, 4)}...${selectedAddress.slice(-4)}`, + h('i.fa.fa-clipboard', { style: { marginLeft: '8px' } }), + ]), ]), this.renderWalletBalance(), |