Skip to content
This repository has been archived by the owner on Oct 25, 2018. It is now read-only.

Commit

Permalink
Update for 0.9 release
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Mar 29, 2016
1 parent 637ec3e commit d7da857
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"stage": 2,
"presets": ['react', 'es2015', 'stage-1'],
"plugins": ['add-module-exports']
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
public/
.gatsby-context.js
34 changes: 14 additions & 20 deletions html.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
import React from 'react'
import DocumentTitle from 'react-document-title'

import { link } from 'gatsby-helpers'
import typography from './utils/typography'
const { TypographyStyle } = typography
import { prefixLink } from 'gatsby-helpers'
import { TypographyStyle } from 'utils/typography'
import { colors } from 'utils/colors'

module.exports = React.createClass({
propTypes () {
return {
title: React.PropTypes.string,
}
displayName: 'HTML',
propTypes: {
body: React.PropTypes.string,
},
render () {
let title = DocumentTitle.rewind()
if (this.props.title) {
title = this.props.title
}
const title = DocumentTitle.rewind()

let cssLink
if (process.env.NODE_ENV === 'production') {
cssLink = <link rel="stylesheet" href={link('/styles.css')} />
cssLink = <link rel="stylesheet" href={prefixLink('/styles.css')} />
}

return (
Expand All @@ -33,7 +28,6 @@ module.exports = React.createClass({
content="width=device-width, initial-scale=1.0 maximum-scale=5.0"
/>
<title>{title}</title>
<link rel="shortcut icon" href={this.props.favicon} />
<TypographyStyle />
{cssLink}
<style
Expand All @@ -44,30 +38,30 @@ module.exports = React.createClass({
color: ${colors.bg};
}
.ball-0 {
background-image: url(${link('/docs/some-react-code/0.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/0.jpg')});
}
.ball-1 {
background-image: url(${link('/docs/some-react-code/1.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/1.jpg')});
}
.ball-2 {
background-image: url(${link('/docs/some-react-code/2.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/2.jpg')});
}
.ball-3 {
background-image: url(${link('/docs/some-react-code/3.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/3.jpg')});
}
.ball-4 {
background-image: url(${link('/docs/some-react-code/4.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/4.jpg')});
}
.ball-5 {
background-image: url(${link('/docs/some-react-code/5.jpg')});
background-image: url(${prefixLink('/docs/some-react-code/5.jpg')});
}
`,
}}
/>
</head>
<body>
<div id="react-mount" dangerouslySetInnerHTML={{ __html: this.props.body }} />
<script src={link('/bundle.js')} />
<script src={prefixLink('/bundle.js')} />
</body>
</html>
)
Expand Down
26 changes: 16 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"name": "docs-site",
"version": "1.0.0",
"description": "Gatsby example site",
"main": "n/a",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public ."
},
"keywords": [
"gatsby"
],
"version": "1.0.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"license": "MIT",
"dependencies": {
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-react-transform": "^1.1.1",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"chroma-js": "0.7.2",
"color-pairs-picker": "^1.3.5",
"gatsby": "^0.9.0",
"lodash": "^4.5.0",
"react": "^0.14.7",
"react-document-title": "^2.0.1",
Expand All @@ -30,9 +26,19 @@
"underscore.string": "^3.2.2"
},
"devDependencies": {
"babel-preset-react-hmre": "^1.1.1",
"eslint": "^2.4.0",
"eslint-config-airbnb": "^6.1.0",
"eslint-plugin-react": "^4.2.1",
"gh-pages": "^0.11.0"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"main": "n/a",
"scripts": {
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1"
}
}
8 changes: 4 additions & 4 deletions pages/_template.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Link } from 'react-router'
import { Container, Grid, Span } from 'react-responsive-grid'
import { link } from 'gatsby-helpers'
import { prefixLink } from 'gatsby-helpers'
import includes from 'underscore.string/include'
import { colors, activeColors } from 'utils/colors'

Expand Down Expand Up @@ -53,7 +53,7 @@ module.exports = React.createClass({
}}
>
<Link
to={link('/')}
to={prefixLink('/')}
style={{
textDecoration: 'none',
color: colors.fg,
Expand All @@ -76,7 +76,7 @@ module.exports = React.createClass({
Github
</a>
<Link
to={link('/examples/')}
to={prefixLink('/examples/')}
style={{
background: examplesActive ? activeColors.bg : colors.bg,
color: examplesActive ? activeColors.fg : colors.fg,
Expand All @@ -93,7 +93,7 @@ module.exports = React.createClass({
Examples
</Link>
<Link
to={link('/docs/')}
to={prefixLink('/docs/')}
style={{
background: docsActive ? activeColors.bg : colors.bg,
color: docsActive ? activeColors.fg : colors.fg,
Expand Down
10 changes: 5 additions & 5 deletions pages/docs/_template.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import { Link } from 'react-router'
import { Breakpoint } from 'react-responsive-grid'
import find from 'lodash/find'
import { link } from 'gatsby-helpers'
import { prefixLink } from 'gatsby-helpers'
import { config } from 'config'

import typography from 'utils/typography'
Expand Down Expand Up @@ -31,15 +31,15 @@ module.exports = React.createClass({
})
const docOptions = childPages.map((child) =>
<option
key={link(child.path)}
value={link(child.path)}
key={prefixLink(child.path)}
value={prefixLink(child.path)}
>
{child.title}
</option>

)
const docPages = childPages.map((child) => {
const isActive = link(child.path) === this.props.location.pathname
const isActive = prefixLink(child.path) === this.props.location.pathname
return (
<li
key={child.path}
Expand All @@ -48,7 +48,7 @@ module.exports = React.createClass({
}}
>
<Link
to={link(child.path)}
to={prefixLink(child.path)}
style={{
textDecoration: 'none',
}}
Expand Down
12 changes: 8 additions & 4 deletions pages/docs/some-react-code/_Demo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Demo = React.createClass({

componentDidMount () {
const rect = ReactDOM.findDOMNode(this).getBoundingClientRect()
this.setState({
this.setState({ // eslint-disable-line react/no-did-mount-set-state
left: rect.left,
top: rect.top,
})
Expand All @@ -21,13 +21,17 @@ const Demo = React.createClass({
if (!currentPositions) {
return { val: range(6).map(() => [0, 0]) }
}
const endValue = currentPositions.val.map((_, i) =>
const endValue = currentPositions.val.map((_, i) => {
// hack. We're getting the currentPositions of the previous ball, but in
// reality it's not really the "current" position. It's the last render's.
// If we want to get the real current position, we'd have to compute it
// now, then read into it now. This gets very tedious with this API.
i === 0 ? this.state.mouse : currentPositions.val[i - 1]
)
if (i === 0) {
return this.state.mouse
} else {
return currentPositions.val[i - 1]
}
})
return { val: endValue, config: [120, 17] }
},

Expand Down
9 changes: 2 additions & 7 deletions utils/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,11 @@ import chroma from 'chroma-js'

import { config } from 'config'

const colors = colorPairsPicker(config.baseColor, {
export const colors = colorPairsPicker(config.baseColor, {
contrast: 5.5,
})

const darker = chroma(config.baseColor).darken(10).hex()
const activeColors = colorPairsPicker(darker, {
export const activeColors = colorPairsPicker(darker, {
contrast: 7,
})

export default {
colors,
activeColors,
}

0 comments on commit d7da857

Please sign in to comment.