diff --git a/client/coral-plugin-permalinks/PermalinkButton.js b/client/coral-plugin-permalinks/PermalinkButton.js index 782e709d7..eb8c9d78d 100644 --- a/client/coral-plugin-permalinks/PermalinkButton.js +++ b/client/coral-plugin-permalinks/PermalinkButton.js @@ -3,6 +3,8 @@ import I18n from 'coral-framework/modules/i18n/i18n'; import translations from './translations'; import onClickOutside from 'react-onclickoutside'; const name = 'coral-plugin-permalinks'; +import {Button} from 'coral-ui'; +import styles from './styles.css'; const lang = new I18n(translations); @@ -32,40 +34,37 @@ class PermalinkButton extends React.Component { this.permalinkInput.select(); try { document.execCommand('copy'); - this.setState({copySuccessful: true}); + this.setState({copySuccessful: true, copyFailure: null}); } catch (err) { - this.setState({copyFailure: true}); + this.setState({copyFailure: true, copySuccessful: null}); } setTimeout(() => { this.setState({copyFailure: null, copySuccessful: null}); - }, 4500); + }, 3500); } render () { + const {copySuccessful, copyFailure} = this.state; return (
-
+
this.permalinkInput = input} value={`${this.props.articleURL}#${this.props.commentId}`} onChange={() => {}} /> - - { - this.state.copySuccessful ?

copied to clipboard

: null - } - { - this.state.copyFailure - ?

copying to clipboard not supported in this browser. Use Cmd + C.

- : null - } +
); diff --git a/client/coral-plugin-permalinks/styles.css b/client/coral-plugin-permalinks/styles.css new file mode 100644 index 000000000..0dc0fd26f --- /dev/null +++ b/client/coral-plugin-permalinks/styles.css @@ -0,0 +1,50 @@ +.container { + border-radius: 3px; + border: solid 1px #D8D8D8; + border-radius: 3px; + padding: 15px 10px; + box-sizing: border-box; + box-shadow: 1px 3px 28px 48px rgba(255, 255, 255, 0.75); + width: auto; + margin: 0 auto; + left: 0; + margin: 0 5px; + + input { + display: inline-block; + width: calc(100% - 78px); + padding: 8px; + border-radius: 3px; + border: solid 1px #e0e0e0; + height: 32px; + box-sizing: border-box; + font-size: 1em; + } + + button { + display: inline-block; + float: right; + box-sizing: border-box; + margin: 0; + background-color: #e0e0e0; + font-size: 1em; + width: auto; + height: auto; + padding: 2px; + transition: background-color 0.4s ease; + + &:hover{ + color: black; + } + + &.success { + background-color: #00897B; + color: white; + } + + &.failure { + background-color: #FF5252; + color: white; + } + } +}