Upgrades for Gatsby 0.8
This commit is contained in:
parent
066c8013c4
commit
4d3c5ca244
6 changed files with 59 additions and 48 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react'
|
||||
import { RouteHandler, Link } from 'react-router'
|
||||
import { Link } from 'react-router'
|
||||
import { Container } from 'react-responsive-grid'
|
||||
import { link } from 'gatsby-helpers'
|
||||
import { rhythm, fontSizeToMS } from 'utils/typography'
|
||||
|
|
@ -7,15 +7,10 @@ import { config } from 'config'
|
|||
|
||||
import '../css/styles.css'
|
||||
|
||||
export default class extends React.Component {
|
||||
propTypes () {
|
||||
return {
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
}
|
||||
class Template extends React.Component {
|
||||
render () {
|
||||
let header
|
||||
if (this.props.route.path === link('/')) {
|
||||
if (this.props.location.pathname === link('/')) {
|
||||
header = (
|
||||
<h1
|
||||
style={{
|
||||
|
|
@ -58,8 +53,16 @@ export default class extends React.Component {
|
|||
}}
|
||||
>
|
||||
{header}
|
||||
<RouteHandler {...this.props}/>
|
||||
{this.props.children}
|
||||
</Container>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Template.propTypes = {
|
||||
children: React.PropTypes.any,
|
||||
location: React.PropTypes.object,
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
|
||||
export default Template
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@ import { rhythm } from 'utils/typography'
|
|||
import access from 'safe-access'
|
||||
import { config } from 'config'
|
||||
|
||||
export default class extends React.Component {
|
||||
propTypes () {
|
||||
return {
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
}
|
||||
class BlogIndex extends React.Component {
|
||||
render () {
|
||||
const pageLinks = []
|
||||
// Sort pages.
|
||||
|
|
@ -20,8 +15,8 @@ export default class extends React.Component {
|
|||
access(page, 'data.date')
|
||||
).reverse()
|
||||
sortedPages.forEach((page) => {
|
||||
const title = access(page, 'data.title') || page.path
|
||||
if (page.path && page.path !== '/' && access(page, 'file.extension') === '.md') {
|
||||
if (access(page, 'file.ext') === 'md') {
|
||||
const title = access(page, 'data.title') || page.path
|
||||
pageLinks.push(
|
||||
<li
|
||||
key={page.path}
|
||||
|
|
@ -62,3 +57,9 @@ export default class extends React.Component {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
BlogIndex.propTypes = {
|
||||
route: React.PropTypes.object,
|
||||
}
|
||||
|
||||
export default BlogIndex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue