From 0a4ebe5e10ae4e817d25f1b9b671e10c420b66f3 Mon Sep 17 00:00:00 2001 From: Luandro Date: Wed, 7 Oct 2015 08:57:25 -0300 Subject: [PATCH 1/5] updated readNext to es6 --- components/ReadNext.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/ReadNext.jsx b/components/ReadNext.jsx index 5eac26a..06f402b 100644 --- a/components/ReadNext.jsx +++ b/components/ReadNext.jsx @@ -3,8 +3,8 @@ import { Link } from 'react-router'; import { prune, include as includes } from 'underscore.string'; import find from 'lodash/collection/find'; -module.exports = React.createClass({ - render: function() { +export default class extends React.Component { + render() { var body, fontSizeToMS, html, nextPost, readNext, ref, rhythm; ref = this.props.typography, rhythm = ref.rhythm, fontSizeToMS = ref.fontSizeToMS; readNext = this.props.post.readNext; @@ -53,4 +53,4 @@ module.exports = React.createClass({ ); } } -}); +} \ No newline at end of file From e68ae6737c66c777190143b17ef07fa9413f4dac Mon Sep 17 00:00:00 2001 From: Luandro Date: Wed, 7 Oct 2015 09:03:10 -0300 Subject: [PATCH 2/5] updated html.jsx to es6 --- components/ReadNext.jsx | 7 +++++-- html.jsx | 18 ++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/components/ReadNext.jsx b/components/ReadNext.jsx index 06f402b..2dda8a0 100644 --- a/components/ReadNext.jsx +++ b/components/ReadNext.jsx @@ -5,8 +5,11 @@ import find from 'lodash/collection/find'; export default class extends React.Component { render() { - var body, fontSizeToMS, html, nextPost, readNext, ref, rhythm; - ref = this.props.typography, rhythm = ref.rhythm, fontSizeToMS = ref.fontSizeToMS; + let body, fontSizeToMS, html, nextPost, readNext, ref, rhythm; + ref = this.props.typography, + rhythm = ref.rhythm, + fontSizeToMS = ref.fontSizeToMS; + readNext = this.props.post.readNext; if (readNext != null) { nextPost = find(this.props.pages, function(page) { diff --git a/html.jsx b/html.jsx index 3552b2d..ee98186 100644 --- a/html.jsx +++ b/html.jsx @@ -2,17 +2,11 @@ import React from 'react'; import Typography from 'typography'; import DocumentTitle from 'react-document-title'; -var TypographyStyle = new Typography().TypographyStyle; +let TypographyStyle = new Typography().TypographyStyle; -module.exports = React.createClass({ - getDefaultProps: function() { - return { - body: "" - }; - }, - - render: function() { - var title, urlPrefix; +export default class Html extends React.Component { + render() { + let title, urlPrefix; title = DocumentTitle.rewind(); if (this.props.title) { title = this.props.title; @@ -56,6 +50,6 @@ module.exports = React.createClass({ ); - } -}); +} +Html.defaultProps = { body: "" }; From 61c82d3b05584efaaed1511de78710aba2fd00e9 Mon Sep 17 00:00:00 2001 From: Luandro Date: Wed, 7 Oct 2015 09:06:58 -0300 Subject: [PATCH 3/5] static es7 --- html.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html.jsx b/html.jsx index ee98186..f840554 100644 --- a/html.jsx +++ b/html.jsx @@ -5,6 +5,7 @@ import DocumentTitle from 'react-document-title'; let TypographyStyle = new Typography().TypographyStyle; export default class Html extends React.Component { + static defaultProps = { body: "" }; render() { let title, urlPrefix; title = DocumentTitle.rewind(); @@ -52,4 +53,4 @@ export default class Html extends React.Component { ); } } -Html.defaultProps = { body: "" }; +// Html.defaultProps = { body: "" }; From befc53d387f3cb040b5bf98ff04cd6d753d7b0b9 Mon Sep 17 00:00:00 2001 From: Luandro Date: Wed, 7 Oct 2015 09:13:44 -0300 Subject: [PATCH 4/5] es7 not workig yet --- html.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/html.jsx b/html.jsx index f840554..ee98186 100644 --- a/html.jsx +++ b/html.jsx @@ -5,7 +5,6 @@ import DocumentTitle from 'react-document-title'; let TypographyStyle = new Typography().TypographyStyle; export default class Html extends React.Component { - static defaultProps = { body: "" }; render() { let title, urlPrefix; title = DocumentTitle.rewind(); @@ -53,4 +52,4 @@ export default class Html extends React.Component { ); } } -// Html.defaultProps = { body: "" }; +Html.defaultProps = { body: "" }; From 63473a730107045d940ec0c2ebc68549d24f1ed4 Mon Sep 17 00:00:00 2001 From: Luandro Date: Wed, 7 Oct 2015 09:17:10 -0300 Subject: [PATCH 5/5] updated index and template to es6 --- pages/_template.jsx | 12 ++++++------ pages/index.jsx | 22 ++++++++++------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pages/_template.jsx b/pages/_template.jsx index 9bd5dee..4435773 100644 --- a/pages/_template.jsx +++ b/pages/_template.jsx @@ -4,14 +4,14 @@ import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid'; import Typography from 'typography'; import { link } from 'gatsby-helpers'; -var typography = new Typography(); -var rhythm = typography.rhythm, fontSizeToMS = typography.fontSizeToMS; +let typography = new Typography(); +let rhythm = typography.rhythm, fontSizeToMS = typography.fontSizeToMS; import '../css/styles.css'; -module.exports = React.createClass({ - render: function() { - var header; +export default class extends React.Component { + render() { + let header; if (this.props.state.path === link('/')) { header = (

); } -}); +} diff --git a/pages/index.jsx b/pages/index.jsx index a883443..41a2d2f 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -4,20 +4,18 @@ import sortBy from 'lodash/collection/sortBy'; import DocumentTitle from 'react-document-title'; import { link } from 'gatsby-helpers'; -module.exports = React.createClass({ - statics: { - data: function() { - return { - yo: true - }; +export default class extends React.Component { + static data() { + return { + yo: true } - }, - render: function() { - var i, len, page, pageLinks, ref, ref1, ref2, rhythm, title; + } + render() { + let i, len, page, pageLinks, ref, ref1, ref2, rhythm, title; rhythm = this.props.typography.rhythm; pageLinks = []; - ref = sortBy(this.props.pages, function(page) { - var ref; + ref = sortBy(this.props.pages, (page) => { + let ref; return (ref = page.data) != null ? ref.date : void 0; }).reverse(); for (i = 0, len = ref.length; i < len; i++) { @@ -63,4 +61,4 @@ module.exports = React.createClass({ ); } -}); +} \ No newline at end of file