diff options
author | Thomas <thomas.b.huang@gmail.com> | 2018-05-04 05:38:49 +0800 |
---|---|---|
committer | Thomas <thomas.b.huang@gmail.com> | 2018-05-04 05:38:49 +0800 |
commit | 025d8e798394fab215a3a41247d4ed2ecf865edd (patch) | |
tree | 5a245136f008d335314d772fab84c61038257d40 /ui/app/components/export-text-container/export-text-container.component.js | |
parent | 1d353c002ddbb636c8291f7e26cf8d8309983e86 (diff) | |
parent | 23e1290e27c165e967a4a642980abc7c18d759b1 (diff) | |
download | tangerine-wallet-browser-025d8e798394fab215a3a41247d4ed2ecf865edd.tar.gz tangerine-wallet-browser-025d8e798394fab215a3a41247d4ed2ecf865edd.tar.zst tangerine-wallet-browser-025d8e798394fab215a3a41247d4ed2ecf865edd.zip |
Merge branch 'e2e-tests' of https://github.com/tmashuang/metamask-extension into e2e-tests
Diffstat (limited to 'ui/app/components/export-text-container/export-text-container.component.js')
-rw-r--r-- | ui/app/components/export-text-container/export-text-container.component.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ui/app/components/export-text-container/export-text-container.component.js b/ui/app/components/export-text-container/export-text-container.component.js new file mode 100644 index 000000000..c2546fa9b --- /dev/null +++ b/ui/app/components/export-text-container/export-text-container.component.js @@ -0,0 +1,45 @@ +const { Component } = require('react') +const PropTypes = require('prop-types') +const h = require('react-hyperscript') +const copyToClipboard = require('copy-to-clipboard') +const { exportAsFile } = require('../../util') + +class ExportTextContainer extends Component { + render () { + const { text = '', filename = '' } = this.props + const { t } = this.context + + return ( + h('.export-text-container', [ + h('.export-text-container__text-container', [ + h('.export-text-container__text', text), + ]), + h('.export-text-container__buttons-container', [ + h('.export-text-container__button.export-text-container__button--copy', { + onClick: () => copyToClipboard(text), + }, [ + h('img', { src: 'images/copy-to-clipboard.svg' }), + h('.export-text-container__button-text', t('copyToClipboard')), + ]), + h('.export-text-container__button', { + onClick: () => exportAsFile(filename, text), + }, [ + h('img', { src: 'images/download.svg' }), + h('.export-text-container__button-text', t('saveAsCsvFile')), + ]), + ]), + ]) + ) + } +} + +ExportTextContainer.propTypes = { + text: PropTypes.string, + filename: PropTypes.string, +} + +ExportTextContainer.contextTypes = { + t: PropTypes.func, +} + +module.exports = ExportTextContainer |