import clsx from 'clsx'; import { localize } from 'i18n-calypso'; import PropTypes from 'prop-types'; import { Component } from 'react'; import { recordPermalinkClick } from 'calypso/reader/stats'; import './style.scss'; class PostExcerptLink extends Component { static propTypes = { siteName: PropTypes.string, postUrl: PropTypes.string, }; state = { isShowingNotice: false, }; toggleNotice = ( event ) => { event.preventDefault(); this.setState( { isShowingNotice: ! this.state.isShowingNotice, } ); }; recordClick = () => { recordPermalinkClick( 'summary_card_site_name' ); }; render() { if ( ! this.props.siteName || ! this.props.postUrl ) { return null; } /*eslint-disable wpcalypso/jsx-classname-namespace*/ const siteName = ( { this.props.siteName || '(untitled)' } ); const classes = clsx( { 'post-excerpt-link': true, 'is-showing-notice': this.state.isShowingNotice, } ); return (
{ this.props.translate( 'The owner of this site only allows us to show a brief summary of their content.' + ' ' + "To view the full post, you'll have to visit their site." ) }