import React, { PropTypes } from 'react';
import { Popover, OverlayTrigger } from 'react-bootstrap';
import CopyToClipboard from './../../components/CopyToClipboard';
import { getShortUrl } from '../../../utils/common';
const propTypes = {
slice: PropTypes.object.isRequired,
};
export default class URLShortLinkButton extends React.Component {
constructor(props) {
super(props);
this.state = {
shortUrl: '',
};
}
onShortUrlSuccess(data) {
this.setState({
shortUrl: data,
});
}
getCopyUrl() {
const longUrl = window.location.pathname + window.location.search;
getShortUrl(longUrl, this.onShortUrlSuccess.bind(this));
}
renderPopover() {
const emailBody = `Check out this slice: ${this.state.shortUrl}`;
return (
}
/>
);
}
render() {
return (
);
}
}
URLShortLinkButton.propTypes = propTypes;