diff --git a/client/coral-admin/src/routes/Moderation/components/ButtonCopyToClipboard.js b/client/coral-admin/src/routes/Moderation/components/ButtonCopyToClipboard.js new file mode 100644 index 000000000..5bc5767ba --- /dev/null +++ b/client/coral-admin/src/routes/Moderation/components/ButtonCopyToClipboard.js @@ -0,0 +1,16 @@ +import React from 'react'; +import {Button} from 'coral-ui'; +import t from 'coral-framework/services/i18n'; +import {withCopyToClipboard} from 'coral-framework/hocs'; + +class ButtonCopyToClipboard extends React.Component { + render () { + return ( + + ); + } +} + +export default withCopyToClipboard(ButtonCopyToClipboard); diff --git a/client/coral-admin/src/routes/Moderation/components/Moderation.js b/client/coral-admin/src/routes/Moderation/components/Moderation.js index 1c1ce1009..2de15f2ff 100644 --- a/client/coral-admin/src/routes/Moderation/components/Moderation.js +++ b/client/coral-admin/src/routes/Moderation/components/Moderation.js @@ -192,6 +192,7 @@ export default class Moderation extends Component { shortcutsNoteVisible={moderation.shortcutsNoteVisible} open={moderation.modalOpen} onClose={this.onClose}/> + {moderation.userDetailId && ( )} + { - setTimeout(() => this.setState({ - emailCopied: false - }), 3000); - }); - } - render () { const { root: { @@ -98,13 +82,11 @@ export default class UserDetail extends React.Component { return (

{user.username}

- {profile && this.profile = ref} value={profile} />} - this.showCopied()} text={profile} className={styles.profileEmail}> - - +
+ {profile && this.profile = ref} value={profile} />} + +
{ + class WithCopyToClipboard extends React.Component { + componentDidMount() { + const clipboard = new Clipboard(ReactDOM.findDOMNode(this)); + + clipboard.on('success', (e) => { + e.clearSelection(); + }); + } + + render() { + const {copyTarget = '', copyText = '', className = '', ...rest} = this.props; + + return ; + } + } + + return WithCopyToClipboard; +}; diff --git a/client/coral-ui/components/Button.css b/client/coral-ui/components/Button.css index 671c55bad..409fc1bc6 100644 --- a/client/coral-ui/components/Button.css +++ b/client/coral-ui/components/Button.css @@ -53,6 +53,16 @@ color: #212121; } +.type--local:hover { + background: #d6d5d5; + color: #212121; +} + +.type--local:active { + background: #cccccc; + color: #212121; +} + .type--facebook { background-color: #4267b2; border-color: #4267b2; diff --git a/client/coral-ui/components/Button.js b/client/coral-ui/components/Button.js index 6d3dc94d2..cbfb6ad61 100644 --- a/client/coral-ui/components/Button.js +++ b/client/coral-ui/components/Button.js @@ -2,20 +2,23 @@ import React from 'react'; import styles from './Button.css'; import Icon from './Icon'; -const Button = ({cStyle = 'local', children, className, raised = false, full = false, icon = '', ...props}) => ( - -); - -export default Button; +export default class Button extends React.Component { + render() { + const {cStyle = 'local', children, className, raised = false, full = false, icon = '', ...props} = this.props; + return ( + + ); + } +} diff --git a/client/coral-ui/components/Copy.js b/client/coral-ui/components/Copy.js deleted file mode 100644 index 7162cd141..000000000 --- a/client/coral-ui/components/Copy.js +++ /dev/null @@ -1,38 +0,0 @@ -import React, {Component} from 'react'; -import Clipboard from 'clipboard'; - -export default class Copy extends Component { - - constructor(props) { - super(props); - this.refCopyButton = this.refCopyButton.bind(this); - } - - componentDidMount() { - const clipboard = new Clipboard(this.copyButtonEl); - - clipboard.on('success', (e) => { - this.props.onCopy(); - e.clearSelection(); - }); - } - - refCopyButton(button) { - this.copyButtonEl = button; - } - - render() { - const {children, target = '', text = ''} = this.props; - - return ( - - {children} - - ); - } -} diff --git a/client/coral-ui/index.js b/client/coral-ui/index.js index d9f960eb2..3e9456727 100644 --- a/client/coral-ui/index.js +++ b/client/coral-ui/index.js @@ -24,4 +24,3 @@ export {default as Option} from './components/Option'; export {default as SnackBar} from './components/SnackBar'; export {default as TextArea} from './components/TextArea'; export {default as Drawer} from './components/Drawer'; -export {default as Copy} from './components/Copy'; diff --git a/locales/en.yml b/locales/en.yml index 4c2ae7c76..2fa1b6bbd 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -33,6 +33,8 @@ en: comment_post_banned_word: "Your comment contains one or more words that are not permitted, so it will not be published. If you think this message is incorrect, please contact our moderation team." comment_post_notif: "Your comment has been posted." comment_post_notif_premod: "Thank you for posting. Our moderation team will review your comment shortly." + common: + copy: 'Copy' community: account_creation_date: "Account Creation Date" active: Active diff --git a/locales/es.yml b/locales/es.yml index d174ed0ee..58bc7a132 100644 --- a/locales/es.yml +++ b/locales/es.yml @@ -33,6 +33,8 @@ es: comment_post_banned_word: "Tu comentario contiene una o más palabras que no están permitidas en nuestro espacio, por lo que no será publicado. Si crees que es un error, por favor contacta a nuestro equipo de moderación." comment_post_notif: "Tu comentario ha sido publicado." comment_post_notif_premod: "Gracias por el comentario. Nuestro equipo de moderación va a revisarlo muy pronto." + common: + copy: 'Copiar' community: account_creation_date: "Fecha de creación de la cuenta" active: Activa