diff --git a/app/extensions/brave/locales/en-US/app.properties b/app/extensions/brave/locales/en-US/app.properties index d4294bc67f8..cb0bc851de6 100644 --- a/app/extensions/brave/locales/en-US/app.properties +++ b/app/extensions/brave/locales/en-US/app.properties @@ -246,3 +246,4 @@ widevinePanelTitle=Brave needs to install Google Widevine to proceed installAndAllow=Install and Allow rememberThisDecision=Remember this decision for {{origin}} copyToClipboard.title=Copy to clipboard +copied=Copied! diff --git a/app/renderer/components/clipboardButton.js b/app/renderer/components/clipboardButton.js new file mode 100644 index 00000000000..ae187de607c --- /dev/null +++ b/app/renderer/components/clipboardButton.js @@ -0,0 +1,85 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const React = require('react') +const {StyleSheet, css} = require('aphrodite') + +/** + * Represents a 'Copy to clipboard' button + */ +class ClipboardButton extends React.Component { + constructor (props) { + super(props) + this.copyAction = props.copyAction + this.onClick = this.onClick.bind(this) + this.onAnimationEnd = this.onAnimationEnd.bind(this) + this.state = { + visibleLabel: false + } + } + + onClick () { + this.setState({ + visibleLabel: true + }) + this.copyAction() + } + + onAnimationEnd () { + this.setState({ + visibleLabel: false + }) + } + + render () { + return + Copiesd! + + { + this.props.textContext + ? this.props.textContext + : '' + } + + + } +} + +const animation = { + '0%': { + opacity: 0 + }, + + '30%': { + opacity: 1 + }, + + '100%': { + opacity: 0 + } +} + +const styles = StyleSheet.create({ + clipboardButton: { + cursor: 'pointer' + }, + doneLabel: { + marginRight: '15px', + opacity: 0, + display: 'none' + }, + visible: { + display: 'inline', + animationName: animation, + animationDuration: '2s', + animationTimingFunction: 'cubic-bezier(0.23, 1, 0.32, 1)' + } +}) + +module.exports = ClipboardButton diff --git a/js/about/brave.js b/js/about/brave.js index bc35852457d..bcb722f1a67 100644 --- a/js/about/brave.js +++ b/js/about/brave.js @@ -6,6 +6,7 @@ const React = require('react') const Immutable = require('immutable') const messages = require('../constants/messages') const SortableTable = require('../components/sortableTable') +const ClipboardButton = require('../../app/renderer/components/clipboardButton') const aboutActions = require('./aboutActions') const ipc = window.chrome.ipcRenderer @@ -43,7 +44,11 @@ class AboutBrave extends React.Component {
- +