diff options
Diffstat (limited to 'ui/app/components/copyButton.js')
-rw-r--r-- | ui/app/components/copyButton.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/ui/app/components/copyButton.js b/ui/app/components/copyButton.js index 355f78d45..a60d33523 100644 --- a/ui/app/components/copyButton.js +++ b/ui/app/components/copyButton.js @@ -1,12 +1,18 @@ const Component = require('react').Component +const PropTypes = require('prop-types') const h = require('react-hyperscript') const inherits = require('util').inherits const copyToClipboard = require('copy-to-clipboard') -const t = require('../../i18n') +const connect = require('react-redux').connect const Tooltip = require('./tooltip') -module.exports = CopyButton +CopyButton.contextTypes = { + t: PropTypes.func, +} + +module.exports = connect()(CopyButton) + inherits(CopyButton, Component) function CopyButton () { @@ -23,7 +29,7 @@ CopyButton.prototype.render = function () { const value = props.value const copied = state.copied - const message = copied ? t('copiedButton') : props.title || t('copyButton') + const message = copied ? this.context.t('copiedButton') : props.title || this.context.t('copyButton') return h('.copy-button', { style: { |