Merge pull request #2 from luandro/master

Updated to es6
This commit is contained in:
Kyle Mathews 2015-10-07 09:39:34 -07:00
commit 950e38687e
4 changed files with 30 additions and 35 deletions

View file

@ -3,10 +3,13 @@ import { Link } from 'react-router';
import { prune, include as includes } from 'underscore.string'; import { prune, include as includes } from 'underscore.string';
import find from 'lodash/collection/find'; import find from 'lodash/collection/find';
module.exports = React.createClass({ export default class extends React.Component {
render: function() { render() {
var body, fontSizeToMS, html, nextPost, readNext, ref, rhythm; let body, fontSizeToMS, html, nextPost, readNext, ref, rhythm;
ref = this.props.typography, rhythm = ref.rhythm, fontSizeToMS = ref.fontSizeToMS; ref = this.props.typography,
rhythm = ref.rhythm,
fontSizeToMS = ref.fontSizeToMS;
readNext = this.props.post.readNext; readNext = this.props.post.readNext;
if (readNext != null) { if (readNext != null) {
nextPost = find(this.props.pages, function(page) { nextPost = find(this.props.pages, function(page) {
@ -53,4 +56,4 @@ module.exports = React.createClass({
); );
} }
} }
}); }

View file

@ -2,17 +2,11 @@ import React from 'react';
import Typography from 'typography'; import Typography from 'typography';
import DocumentTitle from 'react-document-title'; import DocumentTitle from 'react-document-title';
var TypographyStyle = new Typography().TypographyStyle; let TypographyStyle = new Typography().TypographyStyle;
module.exports = React.createClass({ export default class Html extends React.Component {
getDefaultProps: function() { render() {
return { let title, urlPrefix;
body: ""
};
},
render: function() {
var title, urlPrefix;
title = DocumentTitle.rewind(); title = DocumentTitle.rewind();
if (this.props.title) { if (this.props.title) {
title = this.props.title; title = this.props.title;
@ -56,6 +50,6 @@ module.exports = React.createClass({
</body> </body>
</html> </html>
); );
} }
}); }
Html.defaultProps = { body: "" };

View file

@ -4,14 +4,14 @@ import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid';
import Typography from 'typography'; import Typography from 'typography';
import { link } from 'gatsby-helpers'; import { link } from 'gatsby-helpers';
var typography = new Typography(); let typography = new Typography();
var rhythm = typography.rhythm, fontSizeToMS = typography.fontSizeToMS; let rhythm = typography.rhythm, fontSizeToMS = typography.fontSizeToMS;
import '../css/styles.css'; import '../css/styles.css';
module.exports = React.createClass({ export default class extends React.Component {
render: function() { render() {
var header; let header;
if (this.props.state.path === link('/')) { if (this.props.state.path === link('/')) {
header = ( header = (
<h1 <h1
@ -59,4 +59,4 @@ module.exports = React.createClass({
</Container> </Container>
); );
} }
}); }

View file

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