refactor: fixes linting errors components/SitePost/index.jsx

This commit is contained in:
Simon Reinsperger 2017-03-08 17:37:27 +01:00
parent 54642a6757
commit 923a226d9d

View File

@ -1,52 +1,51 @@
import React from 'react' import React from 'react';
import moment from 'moment' import moment from 'moment';
import { RouteHandler, Link } from 'react-router' import { Link } from 'react-router';
import { prefixLink } from 'gatsby-helpers' import { prefixLink } from 'gatsby-helpers';
import access from 'safe-access' import { config } from 'config';
import { config } from 'config' import ReadNext from '../ReadNext';
import ReadNext from '../ReadNext' import './style.css';
import './style.css' import '../../static/css/highlight.css';
import '../../static/css/highlight.css'
class SitePost extends React.Component { class SitePost extends React.Component {
render() { render() {
const {route} = this.props const { route } = this.props;
const post = route.page.data const post = route.page.data;
const home = ( const home = (
<div> <div>
<Link className='gohome' to={ prefixLink('/') }> All Articles <Link className="gohome" to={prefixLink('/')}>All Articles</Link>
</Link> </div>
</div> );
)
return ( return (
<div> <div>
{ home } {home}
<div className='blog-single'> <div className="blog-single">
<div className='text'> <div className="text">
<h1>{ post.title }</h1> <h1>{post.title}</h1>
<div dangerouslySetInnerHTML={ { __html: post.body} } /> <div dangerouslySetInnerHTML={{ __html: post.body }} />
<div className='date-published'> <div className="date-published">
<em>Published { moment(post.date).format('D MMM YYYY') }</em> <em>Published {moment(post.date).format('D MMM YYYY')}</em>
</div>
</div>
<div className='footer'>
<ReadNext post={ post } {...this.props}/>
<hr></hr>
<p>
{ config.siteDescr }
<a href={ config.siteTwitterUrl }>
<br></br> <strong>{ config.siteAuthor }</strong> on Twitter</a>
</p>
</div>
</div>
</div> </div>
); </div>
} <div className="footer">
<ReadNext post={post} {...this.props} />
<hr />
<p>
{config.siteDescr}
<a href={config.siteTwitterUrl}>
<br /> <strong>{config.siteAuthor}</strong> on Twitter
</a>
</p>
</div>
</div>
</div>
);
}
} }
SitePost.propTypes = { SitePost.propTypes = {
route: React.PropTypes.object.isRequired route: React.PropTypes.object.isRequired,
} };
export default SitePost export default SitePost;