1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add CopyButton component

This commit is contained in:
Dan Finlay 2016-06-29 14:11:12 -07:00
parent 757a3ce6be
commit 441a7eec28

View File

@ -0,0 +1,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)
},
})
}