RevisionUrl.js 823 B

123456789101112131415161718192021222324252627282930313233
  1. import React from 'react';
  2. import CopyButton from '../CopyButton';
  3. export default class RevisionUrl extends React.Component {
  4. showToolTip() {
  5. $('#btnCopy').tooltip('show');
  6. setTimeout(() => {
  7. $('#btnCopy').tooltip('hide');
  8. }, 1000);
  9. }
  10. render() {
  11. const buttonStyle = {
  12. fontSize: "1em"
  13. }
  14. const urlText = decodeURIComponent(this.props.url);
  15. const copiedText = this.props.pagePath + '\n' + this.props.url;
  16. return (
  17. <span>
  18. {urlText}
  19. <CopyButton buttonId="btnCopyRevisionUrl" text={copiedText}
  20. buttonClassName="btn btn-default" buttonStyle={buttonStyle} iconClassName="fa fa-link text-muted" />
  21. </span>
  22. );
  23. }
  24. }
  25. RevisionUrl.propTypes = {
  26. pagePath: React.PropTypes.string.isRequired,
  27. url: React.PropTypes.string.isRequired,
  28. };