From 1ecf9b79599fc7e202b273226f058a208286664d Mon Sep 17 00:00:00 2001 From: Gianluca Esposito Date: Thu, 10 Sep 2015 21:43:55 +0200 Subject: [PATCH] Converted index to ES6 --- pages/index.cjsx | 53 -------------------------------------- pages/index.jsx | 66 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 53 deletions(-) delete mode 100644 pages/index.cjsx create mode 100644 pages/index.jsx diff --git a/pages/index.cjsx b/pages/index.cjsx deleted file mode 100644 index 1cba76e..0000000 --- a/pages/index.cjsx +++ /dev/null @@ -1,53 +0,0 @@ -React = require 'react' -Router = require 'react-router' -{RouteHandler, Link} = Router -sortBy = require 'lodash/collection/sortBy' -DocumentTitle = require 'react-document-title' -{link} = require 'gatsby-helpers' - -module.exports = React.createClass - statics: - data: -> - yo: true - - render: -> - {rhythm} = @props.typography - pageLinks = [] - for page in sortBy(@props.pages, (page) -> page.data?.date).reverse() - title = page.data?.title || page.path - if page.path isnt link("/") and not page.data?.draft - pageLinks.push ( -
  • - {title} -
  • - ) - - -
    -

    - - Written by {@props.config.authorName} who lives and works in San Francisco building useful things. You should follow him on Twitter -

    -
      - {pageLinks} -
    -
    -
    diff --git a/pages/index.jsx b/pages/index.jsx new file mode 100644 index 0000000..a883443 --- /dev/null +++ b/pages/index.jsx @@ -0,0 +1,66 @@ +import React from 'react'; +import { RouteHandler, Link } from 'react-router'; +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 + }; + } + }, + render: function() { + var i, len, page, pageLinks, ref, ref1, ref2, rhythm, title; + rhythm = this.props.typography.rhythm; + pageLinks = []; + ref = sortBy(this.props.pages, function(page) { + var ref; + return (ref = page.data) != null ? ref.date : void 0; + }).reverse(); + for (i = 0, len = ref.length; i < len; i++) { + page = ref[i]; + title = ((ref1 = page.data) != null ? ref1.title : void 0) || page.path; + if (page.path !== link("/") && !((ref2 = page.data) != null ? ref2.draft : void 0)) { + pageLinks.push( +
  • + {title} +
  • + ); + } + } + return ( + +
    +

    + + Written by {this.props.config.authorName} who lives and works in San Francisco building useful things. You should follow him on Twitter +

    +
      + {pageLinks} +
    +
    +
    + ); + } +});