mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 04:32:32 +02:00
Update
This commit is contained in:
@@ -6,56 +6,38 @@ import find from 'lodash/find'
|
||||
import './style.sss'
|
||||
|
||||
class ReadNext extends React.Component {
|
||||
render() {
|
||||
const { pages, post } = this.props
|
||||
const { readNext } = post
|
||||
render() {
|
||||
const {pages, post} = this.props
|
||||
const {readNext} = post
|
||||
|
||||
let nextPost
|
||||
if (readNext) {
|
||||
nextPost = find(pages, (page) =>
|
||||
includes(page.path, readNext)
|
||||
)
|
||||
}
|
||||
if (!nextPost) {
|
||||
return React.createElement('noscript', null)
|
||||
} else {
|
||||
nextPost = find(pages, (page) =>
|
||||
includes(page.path, readNext.slice(1, -1))
|
||||
)
|
||||
const description = nextPost.data.description
|
||||
let nextPost
|
||||
if (readNext) {
|
||||
nextPost = find(pages, (page) => includes(page.path, readNext)
|
||||
)
|
||||
}
|
||||
if (!nextPost) {
|
||||
return React.createElement('noscript', null)
|
||||
} else {
|
||||
nextPost = find(pages, (page) => includes(page.path, readNext.slice(1, -1))
|
||||
)
|
||||
const description = nextPost.data.description
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h6
|
||||
style={{
|
||||
fontSize: '16px',
|
||||
margin: '20px 0 0'
|
||||
}}
|
||||
>
|
||||
READ THIS NEXT:
|
||||
</h6>
|
||||
<h3
|
||||
style={{
|
||||
margin: '5px 0 0'
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
to={nextPost.path}
|
||||
query={{readNext: true}}
|
||||
>
|
||||
{nextPost.data.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<p className='description'>{description}</p>
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<div>
|
||||
<h6 style={ { fontSize: '16px', margin: '20px 0 0'} }>READ THIS NEXT:</h6>
|
||||
<h3 style={ { margin: '5px 0 0'} }><Link to={ nextPost.path } query={ { readNext: true} } > { nextPost.data.title } </Link></h3>
|
||||
<p className='description'>
|
||||
{ description }
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReadNext.propTypes = {
|
||||
post: React.PropTypes.object.isRequired,
|
||||
pages: React.PropTypes.array,
|
||||
post: React.PropTypes.object.isRequired,
|
||||
pages: React.PropTypes.array,
|
||||
}
|
||||
|
||||
export default ReadNext
|
Reference in New Issue
Block a user