Fix eslint errors
This commit is contained in:
parent
f856fe0060
commit
d0552c19b2
10 changed files with 179 additions and 139 deletions
|
|
@ -1,28 +1,33 @@
|
|||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { prune, include as includes } from 'underscore.string';
|
||||
import find from 'lodash/collection/find';
|
||||
import React from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import { prune, include as includes } from 'underscore.string'
|
||||
import find from 'lodash/collection/find'
|
||||
import { rhythm, fontSizeToMS } from 'utils/typography'
|
||||
import { link } from 'gatsby-helpers'
|
||||
|
||||
export default class extends React.Component {
|
||||
render() {
|
||||
let body, html, nextPost, readNext;
|
||||
readNext = this.props.post.readNext;
|
||||
if (readNext != null) {
|
||||
nextPost = find(this.props.pages, function(page) {
|
||||
return includes(page.path, readNext.slice(1, -1));
|
||||
});
|
||||
export default class ReadNext extends React.Component {
|
||||
propTypes () {
|
||||
return {
|
||||
post: React.PropTypes.object,
|
||||
pages: React.PropTypes.object,
|
||||
}
|
||||
}
|
||||
render () {
|
||||
const readNext = this.props.post.readNext
|
||||
let nextPost
|
||||
if (readNext !== null) {
|
||||
nextPost = find(this.props.pages, (page) =>
|
||||
includes(page.path, readNext.slice(1, -1))
|
||||
)
|
||||
}
|
||||
if (!nextPost) {
|
||||
return React.createElement("noscript", null);
|
||||
return React.createElement('noscript', null)
|
||||
} else {
|
||||
nextPost = find(this.props.pages, function(page) {
|
||||
return includes(page.path, readNext.slice(1, -1));
|
||||
});
|
||||
nextPost = find(this.props.pages, (page) =>
|
||||
includes(page.path, readNext.slice(1, -1))
|
||||
)
|
||||
// Create pruned version of the body.
|
||||
html = nextPost.data.body;
|
||||
body = prune(html.replace(/<[^>]*>/g, ''), 200);
|
||||
const html = nextPost.data.body
|
||||
const body = prune(html.replace(/<[^>]*>/g, ''), 200)
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
|
@ -31,19 +36,19 @@ export default class extends React.Component {
|
|||
margin: 0,
|
||||
fontSize: fontSizeToMS(-1).fontSize,
|
||||
lineHeight: fontSizeToMS(-1).lineHeight,
|
||||
letterSpacing: -0.5
|
||||
letterSpacing: -0.5,
|
||||
}}
|
||||
>
|
||||
READ THIS NEXT:
|
||||
</h6>
|
||||
<h3
|
||||
style={{
|
||||
marginBottom: rhythm(1/4)
|
||||
marginBottom: rhythm(1/4),
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
to={nextPost.path}
|
||||
query={{readNext: true}}
|
||||
query={{ readNext: true }}
|
||||
>
|
||||
{nextPost.data.title}
|
||||
</Link>
|
||||
|
|
@ -51,7 +56,7 @@ export default class extends React.Component {
|
|||
<p>{body}</p>
|
||||
<hr />
|
||||
</div>
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue