aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/copyButton.js
blob: 74fd673c2616dd7292504251e00ae1f1203ca5d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const Component = require('react').Component
const h = require('react-hyperscript')
const inherits = require('util').inherits
const copyToClipboard = require('copy-to-clipboard')

module.exports = CopyButton

inherits(CopyButton, Component)
function CopyButton () {
  Component.call(this)
}

CopyButton.prototype.render = function () {
  const props = this.props
  const value = props.value

  return h('img.cursor-pointer.color-orange', {
    src: 'images/copy.svg',
    title: 'Copy Address',
    onClick: (event) => {
      event.preventDefault()
      event.stopPropagation()
      copyToClipboard(value)
    },
  })
}