From dd89ecea430f066e7a6c658359549b937c30415a Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Wed, 19 Oct 2016 12:24:22 +0100 Subject: [PATCH] Add 'Copy to Clipboard' icon in Accounts Header (#2167) (#2716) --- js/src/views/Account/Header/header.js | 46 ++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/js/src/views/Account/Header/header.js b/js/src/views/Account/Header/header.js index 0abf3c797..373576a49 100644 --- a/js/src/views/Account/Header/header.js +++ b/js/src/views/Account/Header/header.js @@ -15,6 +15,11 @@ // along with Parity. If not, see . import React, { Component, PropTypes } from 'react'; +import CopyToClipboard from 'react-copy-to-clipboard'; +import IconButton from 'material-ui/IconButton'; +import Snackbar from 'material-ui/Snackbar'; +import CopyIcon from 'material-ui/svg-icons/content/content-copy'; +import { lightWhite, fullWhite, lightBlack } from 'material-ui/styles/colors'; import { Balance, Container, ContainerTitle, IdentityIcon, IdentityName, Tags } from '../../../ui'; @@ -32,7 +37,8 @@ export default class Header extends Component { } state = { - name: null + name: null, + addressCopied: false } componentWillMount () { @@ -45,6 +51,7 @@ export default class Header extends Component { render () { const { account, balance } = this.props; + const { addressCopied } = this.state; const { address, meta, uuid } = account; if (!account) { @@ -62,6 +69,35 @@ export default class Header extends Component {
} />
+ + + + + + { address }
{ uuidText } @@ -111,6 +147,14 @@ export default class Header extends Component { }); } + handleCopyAddress = () => { + this.setState({ addressCopied: true }); + } + + handleCopyAddressClose = () => { + this.setState({ addressCopied: false }); + } + setName () { const { account } = this.props;