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:
parent
757a3ce6be
commit
441a7eec28
26
ui/app/components/copyButton.js
Normal file
26
ui/app/components/copyButton.js
Normal 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)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user