Merge pull request #4 from gesposito/master

Update dependencies, use .js file extensions
This commit is contained in:
Kyle Mathews 2016-02-21 15:58:34 -08:00
commit d70ecc146e
7 changed files with 28 additions and 21 deletions

View file

@ -3,3 +3,6 @@ Gatsby starter for creating a blog
Install this starter (assuming Gatsby is installed) by running from your CLI:
`gatsby new gatsby-blog https://github.com/gatsbyjs/gatsby-starter-blog`
## Running in development
`gatsby develop`

View file

@ -6,17 +6,18 @@ import { rhythm, fontSizeToMS } from 'utils/typography'
class ReadNext extends React.Component {
render () {
const readNext = this.props.post.readNext
const { pages, post } = this.props
const { readNext } = post
let nextPost
if (readNext) {
nextPost = find(this.props.pages, (page) =>
nextPost = find(pages, (page) =>
includes(page.path, readNext)
)
}
if (!nextPost) {
return React.createElement('noscript', null)
} else {
nextPost = find(this.props.pages, (page) =>
nextPost = find(pages, (page) =>
includes(page.path, readNext.slice(1, -1))
)
// Create pruned version of the body.

View file

@ -4,14 +4,8 @@ import { link } from 'gatsby-helpers'
import { TypographyStyle } from 'utils/typography'
export default class Html extends React.Component {
propTypes () {
return {
body: React.PropTypes.string,
favicon: React.PropTypes.string,
title: React.PropTypes.string,
}
}
render () {
const { favicon, body } = this.props
let title = DocumentTitle.rewind()
if (this.props.title) {
title = this.props.title
@ -27,7 +21,7 @@ export default class Html extends React.Component {
content="user-scalable=no width=device-width, initial-scale=1.0 maximum-scale=1.0"
/>
<title>{this.props.title}</title>
<link rel="shortcut icon" href={this.props.favicon}/>
<link rel="shortcut icon" href={favicon}/>
<TypographyStyle/>
<style
dangerouslySetInnerHTML={{
@ -51,7 +45,7 @@ export default class Html extends React.Component {
/>
</head>
<body className="landing-page">
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<div id="react-mount" dangerouslySetInnerHTML={{ __html: body }} />
<script src={link('/bundle.js')}/>
</body>
</html>
@ -59,4 +53,10 @@ export default class Html extends React.Component {
}
}
Html.propTypes = {
body: React.PropTypes.string,
favicon: React.PropTypes.string,
title: React.PropTypes.string,
}
Html.defaultProps = { body: '' }

View file

@ -5,7 +5,8 @@
"main": "n/a",
"scripts": {
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "gatsby develop"
},
"repository": {
"type": "git",
@ -22,21 +23,21 @@
"homepage": "https://github.com/gatsbyjs/gatsby-starter-blog#readme",
"dependencies": {
"lodash": "^4.5.0",
"moment": "^2.10.3",
"moment": "^2.11.2",
"react": "^0.14.7",
"react-document-title": "^2.0.1",
"react-dom": "^0.14.7",
"react-responsive-grid": "^0.3.0",
"react-responsive-grid": "^0.3.1",
"react-router": "^2.0.0",
"safe-access": "^0.1.0",
"typography": "^0.7.0",
"underscore.string": "^3.2.2"
"underscore.string": "^3.2.3"
},
"devDependencies": {
"babel-plugin-react-transform": "^1.1.1",
"eslint": "^1.10.3",
"eslint-config-airbnb": "^5.0.1",
"eslint-plugin-react": "^4.0.0",
"eslint-plugin-react": "^3.16.1",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.0",
"redbox-react": "^1.0.1"

View file

@ -9,8 +9,9 @@ import '../css/styles.css'
class Template extends React.Component {
render () {
const { location, children } = this.props
let header
if (this.props.location.pathname === link('/')) {
if (location.pathname === link('/')) {
header = (
<h1
style={{
@ -53,7 +54,7 @@ class Template extends React.Component {
}}
>
{header}
{this.props.children}
{children}
</Container>
)
}

View file

@ -10,7 +10,8 @@ import '../css/zenburn.css'
class MarkdownWrapper extends React.Component {
render () {
const post = this.props.route.page.data
const { route } = this.props
const post = route.page.data
return (
<DocumentTitle title={`${post.title} | ${config.blogTitle}`}>
@ -30,7 +31,7 @@ class MarkdownWrapper extends React.Component {
marginBottom: rhythm(2),
}}
/>
<ReadNext post={post} pages={this.props.route.pages} />
<ReadNext post={post} pages={route.pages} />
<p>
<img
src={link('/kyle-round-small-pantheon.jpg')}