Upgrade to alpha-2
This commit is contained in:
parent
94a2ab7ea3
commit
640be90860
12 changed files with 200 additions and 116 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import React from 'react'
|
||||
import { config } from 'config'
|
||||
import { rhythm } from 'utils/typography'
|
||||
import { prefixLink } from 'gatsby-helpers'
|
||||
import profilePic from './profile-pic.jpg'
|
||||
|
|
@ -14,7 +13,7 @@ class Bio extends React.Component {
|
|||
>
|
||||
<img
|
||||
src={prefixLink(profilePic)}
|
||||
alt={`author ${config.authorName}`}
|
||||
alt={`author name`}
|
||||
style={{
|
||||
float: 'left',
|
||||
marginRight: rhythm(1/4),
|
||||
|
|
@ -23,7 +22,7 @@ class Bio extends React.Component {
|
|||
height: rhythm(2),
|
||||
}}
|
||||
/>
|
||||
Written by <strong>{config.authorName}</strong> who lives and works in San Francisco building useful things. <a href="https://twitter.com/kylemathews">You should follow him on Twitter</a>
|
||||
Written by <strong>TODO author name</strong> who lives and works in TODO San Francisco building useful things. <a href="https://twitter.com/kylemathews">You should follow him on Twitter</a>
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,20 @@
|
|||
import React from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import { prefixLink } from 'gatsby-helpers'
|
||||
import { prune, include as includes } from 'underscore.string'
|
||||
import find from 'lodash/find'
|
||||
import { rhythm, fontSizeToMS } from 'utils/typography'
|
||||
const React = require('react')
|
||||
const { Link } = require('react-router')
|
||||
|
||||
class ReadNext extends React.Component {
|
||||
const { rhythm, adjustFontSizeToMSValue } = require('utils/typography')
|
||||
|
||||
const Component = React.createClass({
|
||||
render () {
|
||||
const { pages, post } = this.props
|
||||
const { readNext } = post
|
||||
let nextPost
|
||||
if (readNext) {
|
||||
nextPost = find(pages, (page) =>
|
||||
includes(page.path, readNext)
|
||||
)
|
||||
}
|
||||
const { nextPost } = this.props
|
||||
if (!nextPost) {
|
||||
return React.createElement('noscript', null)
|
||||
return null
|
||||
} else {
|
||||
nextPost = find(pages, (page) =>
|
||||
includes(page.path, readNext.slice(1, -1))
|
||||
)
|
||||
// Create pruned version of the body.
|
||||
const html = nextPost.data.body
|
||||
const body = prune(html.replace(/<[^>]*>/g, ''), 200)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h6
|
||||
style={{
|
||||
...adjustFontSizeToMSValue(-0.5),
|
||||
margin: 0,
|
||||
fontSize: fontSizeToMS(-0.5).fontSize,
|
||||
lineHeight: fontSizeToMS(-0.5).lineHeight,
|
||||
letterSpacing: -0.25,
|
||||
}}
|
||||
>
|
||||
|
|
@ -39,32 +22,32 @@ class ReadNext extends React.Component {
|
|||
</h6>
|
||||
<h3
|
||||
style={{
|
||||
marginTop: 0,
|
||||
marginBottom: rhythm(1/4),
|
||||
margin: 0,
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
to={{
|
||||
pathname: prefixLink(nextPost.path),
|
||||
query: {
|
||||
readNext: true,
|
||||
},
|
||||
}}
|
||||
to={nextPost.path}
|
||||
>
|
||||
{nextPost.data.title}
|
||||
{nextPost.frontmatter.title}
|
||||
</Link>
|
||||
</h3>
|
||||
<p>{body}</p>
|
||||
<p>{nextPost.excerpt}</p>
|
||||
<hr />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
ReadNext.propTypes = {
|
||||
post: React.PropTypes.object.isRequired,
|
||||
pages: React.PropTypes.array,
|
||||
}
|
||||
export default Component
|
||||
|
||||
export const query = `
|
||||
readNext {
|
||||
id
|
||||
excerpt(pruneLength: 200)
|
||||
frontmatter {
|
||||
title
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export default ReadNext
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue