Update dependencies, use .js file extensions
This commit is contained in:
parent
4d3c5ca244
commit
65431b45bb
7 changed files with 28 additions and 21 deletions
65
pages/index.js
Normal file
65
pages/index.js
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import React from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import sortBy from 'lodash/sortBy'
|
||||
import DocumentTitle from 'react-document-title'
|
||||
import { link } from 'gatsby-helpers'
|
||||
import { rhythm } from 'utils/typography'
|
||||
import access from 'safe-access'
|
||||
import { config } from 'config'
|
||||
|
||||
class BlogIndex extends React.Component {
|
||||
render () {
|
||||
const pageLinks = []
|
||||
// Sort pages.
|
||||
const sortedPages = sortBy(this.props.route.pages, (page) =>
|
||||
access(page, 'data.date')
|
||||
).reverse()
|
||||
sortedPages.forEach((page) => {
|
||||
if (access(page, 'file.ext') === 'md') {
|
||||
const title = access(page, 'data.title') || page.path
|
||||
pageLinks.push(
|
||||
<li
|
||||
key={page.path}
|
||||
style={{
|
||||
marginBottom: rhythm(1/4),
|
||||
}}
|
||||
>
|
||||
<Link to={link(page.path)}>{title}</Link>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
})
|
||||
return (
|
||||
<DocumentTitle title={config.blogTitle}>
|
||||
<div>
|
||||
<p
|
||||
style={{
|
||||
marginBottom: rhythm(2.5),
|
||||
}}
|
||||
>
|
||||
<img
|
||||
src="./kyle-round-small-pantheon.jpg"
|
||||
style={{
|
||||
float: 'left',
|
||||
marginRight: rhythm(1/4),
|
||||
marginBottom: 0,
|
||||
width: rhythm(2),
|
||||
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>
|
||||
</p>
|
||||
<ul>
|
||||
{pageLinks}
|
||||
</ul>
|
||||
</div>
|
||||
</DocumentTitle>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
BlogIndex.propTypes = {
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
|
||||
export default BlogIndex
|
||||
Loading…
Add table
Add a link
Reference in a new issue