Skip to content

Commit

Permalink
Issue 29/refactor gatsby starter default (gatsbyjs#31)
Browse files Browse the repository at this point in the history
* Delete TravisCI config

* Remove gh-pages dependency and add prettier

* Change double quotes to single quotes in src files

* Update packages, refactor classes to stateless components and update
readme

* Removed package-lock as yarn is the default for this project

* Readded travis yml

* Remove travis config

* Remove Eslint and Editorconfig

* Remove html.js as it's already imported implicitely

* Update lock file
  • Loading branch information
saviomuc authored and KyleAMathews committed Jul 25, 2017
1 parent bdbd02f commit 1f1b01d
Show file tree
Hide file tree
Showing 11 changed files with 401 additions and 364 deletions.
31 changes: 3 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# Project dependencies
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
.gatsby-context.js
.sass-cache/
public/
.cache/
# Build directory
public/
.DS_Store
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# gatsby-starter-default
The default Gatsby starter

For an overview of the project structure please refer to the [Gatsby documentation - Building with Components](https://www.gatsbyjs.org/docs/building-with-components/)

Install this starter (assuming Gatsby is installed) by running from your CLI:
```
gatsby new gatsby-example-site
```

## Deploy

[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@
"gatsby-link": "^1.0.1",
"gatsby-plugin-react-helmet": "^1.0.1"
},
"devDependencies": {
"gh-pages": "^0.12.0"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"main": "n/a",
"scripts": {
"build": "gatsby build",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"develop": "gatsby develop",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write \"pages/*.js\" \"utils/*.js\" \"wrappers/*.js\" \"html.js\"",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"prettier": "^1.5.2"
}
}
45 changes: 0 additions & 45 deletions src/html.js

This file was deleted.

File renamed without changes.
114 changes: 59 additions & 55 deletions src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,66 @@
import React from "react"
import PropTypes from "prop-types"
import Link from "gatsby-link"
import Helmet from "react-helmet"
import React from 'react'
import PropTypes from 'prop-types'
import Link from 'gatsby-link'
import Helmet from 'react-helmet'

import "../css/typography.css"
import './index.css'

export default class Template extends React.Component {
static propTypes = {
children: PropTypes.func,
}

render() {
return (
<div>
<Helmet
title="Gatsby Default Starter"
meta={[
{ name: "description", content: "Sample" },
{ name: "keywords", content: "sample, something" },
]}
/>
<div
style={{
background: `rebeccapurple`,
marginBottom: `1.45rem`,
}}
>
<div
style={{
margin: `0 auto`,
maxWidth: 960,
padding: `1.45rem 1.0875rem`,
}}
>
<h1 style={{ margin: 0 }}>
<Link
to="/"
style={{
color: "white",
textDecoration: "none",
}}
>
Gatsby
</Link>
</h1>
</div>
</div>
<div
const Header = () => (
<div
style={{
background: 'rebeccapurple',
marginBottom: '1.45rem',
}}
>
<div
style={{
margin: '0 auto',
maxWidth: 960,
padding: '1.45rem 1.0875rem',
}}
>
<h1 style={{ margin: 0 }}>
<Link
to="/"
style={{
margin: `0 auto`,
maxWidth: 960,
padding: `0px 1.0875rem 1.45rem`,
paddingTop: 0,
color: 'white',
textDecoration: 'none',
}}
>
{this.props.children()}
</div>
Gatsby
</Link>
</h1>
</div>
</div>
)

const TemplateWrapper = ({
children
}) => (
<div>
<Helmet
title="Gatsby Default Starter"
meta={[
{ name: 'description', content: 'Sample' },
{ name: 'keywords', content: 'sample, something' },
]}
/>
<Header />
<div
style={{
margin: '0 auto',
maxWidth: 960,
padding: '0px 1.0875rem 1.45rem',
paddingTop: 0,
}}
>
{children()}
</div>
)
}
</div>
)

TemplateWrapper.propTypes = {
children: PropTypes.func,
}

export default TemplateWrapper
9 changes: 6 additions & 3 deletions src/pages/404.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from "react"
import React from 'react'

export default () =>
const NotFoundPage = () => (
<div>
<h1>NOT FOUND</h1>
<p>You just hit a route that doesn't exist... the sadness.</p>
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
</div>
)

export default NotFoundPage
27 changes: 12 additions & 15 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import React from "react"
import Link from "gatsby-link"
import Helmet from "react-helmet"
import React from 'react'
import Link from 'gatsby-link'

export default class Index extends React.Component {
render() {
return (
<div>
<h1>Hi people</h1>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<Link to="/page-2/">Go to page 2</Link>
</div>
)
}
}
const IndexPage = () => (
<div>
<h1>Hi people</h1>
<p>Welcome to your new Gatsby site.</p>
<p>Now go build something great.</p>
<Link to="/page-2/">Go to page 2</Link>
</div>
)

export default IndexPage
25 changes: 11 additions & 14 deletions src/pages/page-2.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import React from "react"
import Link from "gatsby-link"
import Helmet from "react-helmet"
import React from 'react'
import Link from 'gatsby-link'

export default class Page2 extends React.Component {
render() {
return (
<div>
<h1>Hi people</h1>
<p>Welcome to page 2</p>
<Link to="/">Go back to the homepage</Link>
</div>
)
}
}
const SecondPage = () => (
<div>
<h1>Hi people</h1>
<p>Welcome to page 2</p>
<Link to="/">Go back to the homepage</Link>
</div>
)

export default SecondPage
Loading

0 comments on commit 1f1b01d

Please sign in to comment.