import React from 'react'; class AssetInfo extends React.Component { constructor (props) { super(props); this.state = { showDetails: false, } this.toggleDetails = this.toggleDetails.bind(this); this.copyToClipboard = this.copyToClipboard.bind(this); } toggleDetails () { if (this.state.showDetails) { return this.setState({showDetails: false}); } this.setState({showDetails: true}); } copyToClipboard (event) { var elementToCopy = event.target.dataset.elementtocopy; var element = document.getElementById(elementToCopy); element.select(); try { document.execCommand('copy'); } catch (err) { this.setState({error: 'Oops, unable to copy'}); } } render () { return (
{this.props.channelName &&
Channel:
{this.props.channelName}
} {this.props.description &&
{this.props.description}
}
Embed:
{(this.props.contentType === 'video/mp4') ? ( `}/> ) : ( `} /> )}
Share:
twitter facebook tumblr reddit
{ this.state.showDetails &&
Claim Name:
{this.props.name}
Claim Id:
{this.props.claimId}
File Type:
{this.props.contentType ? `${this.props.contentType}` : 'unknown'}
Report
}
{this.state.showDetails ? '[less]' : '[more]'}
); } }; // required props // {channelName, certificateId, description, shortClaimId, name, fileExt, claimId, contentType, thumbnail, host} export default AssetInfo;