{user.username}
{profile && this.profile = ref} value={profile} />}
-
- this.showCopied()} text={profile}>
-
-
{
- this.props.onCopy();
- e.clearSelection();
- });
- }
-
- refCopyButton(button) {
- this.copyButtonEl = button;
- }
-
- render() {
- const {children, target = '', text = '', className = ''} = this.props;
-
- return (
-
- {children}
-
- );
- }
-}
diff --git a/client/coral-framework/components/index.js b/client/coral-framework/components/index.js
index 6c9a3f876..b7aaef665 100644
--- a/client/coral-framework/components/index.js
+++ b/client/coral-framework/components/index.js
@@ -1,2 +1 @@
export {default as Slot} from './Slot';
-export {default as Copy} from './Copy';
diff --git a/client/coral-framework/hocs/index.js b/client/coral-framework/hocs/index.js
index 01b3daff4..782f840bd 100644
--- a/client/coral-framework/hocs/index.js
+++ b/client/coral-framework/hocs/index.js
@@ -1,4 +1,4 @@
export {default as withFragments} from './withFragments';
export {default as withMutation} from './withMutation';
export {default as withQuery} from './withQuery';
-
+export {default as withCopyToClipboard} from './withCopyToClipboard';
diff --git a/client/coral-framework/hocs/withCopyToClipboard.js b/client/coral-framework/hocs/withCopyToClipboard.js
new file mode 100644
index 000000000..2ca9e1b13
--- /dev/null
+++ b/client/coral-framework/hocs/withCopyToClipboard.js
@@ -0,0 +1,33 @@
+import React from 'react';
+import Clipboard from 'clipboard';
+
+export default (config) => (WrappedComponent) => {
+ console.log(config, WrappedComponent)
+
+ class withCopyToClipboard extends React.Component {
+
+ componentDidMount() {
+ const node = ReactDOM.findDOMNode(WrappedComponent);
+ const clipboard = new Clipboard(node);
+
+ clipboard.on('success', (e) => {
+ this.props.onCopy();
+ e.clearSelection();
+ });
+ }
+
+ render() {
+ const {target = '', text = ''} = config;
+
+ return ;
+ }
+ }
+
+ return withCopyToClipboard;
+};