Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Added moment.js & updated Twitter link
Browse files Browse the repository at this point in the history
  • Loading branch information
mmmavis committed May 27, 2015
1 parent 9c4ce6e commit 280c772
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"mocha": "^2.1.0",
"mocha-phantomjs": "^3.5.3",
"mofo-style": "^1.0.1",
"moment": "^2.10.3",
"phantomjs": "^1.9.16",
"react": "^0.13.1",
"react-ga": "^1.0.12",
Expand Down
21 changes: 9 additions & 12 deletions pages/home.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
var React = require('react');
var Router = require('react-router');
var Link = Router.Link;
var moment = require('moment');

var HeroUnit = require('../components/hero-unit.jsx');
var Blockquote = require('../components/blockquote.jsx');
var Illustration = require('../components/illustration.jsx');
var IconLinks = require('../components/icon-links.jsx');
var IconLink = require('../components/icon-link.jsx');

var config = require('../lib/config');

var CaseStudies = React.createClass({
render: function() {
return (
Expand All @@ -30,16 +33,15 @@ var FeaturedPost = React.createClass({
data: React.PropTypes.object.isRequired
},
render: function() {
var publishedDate = new Date(this.props.data.publishedDate);
var month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][publishedDate.getMonth()];
var parsedDate = moment(this.props.data.publishedDate);
return(
<div className="featured-post">
<div className="entry-posted-container">
<p className="entry-posted">
<time className="published" title={this.props.data.publishedDate} dateTime={this.props.data.publishedDate} >
<span className="posted-month">{month}</span>
<span className="posted-date">{publishedDate.getDate()}</span>
<span className="posted-year">{publishedDate.getFullYear()}</span>
<span className="posted-month">{parsedDate.format("MMM")}</span>
<span className="posted-date">{parsedDate.format("DD")}</span>
<span className="posted-year">{parsedDate.format("YYYY")}</span>
</time>
</p>
</div>
Expand All @@ -61,11 +63,6 @@ var LatestPosts = React.createClass({
data: React.PropTypes.array.isRequired
},
render: function() {
function formatDate(theDate) {
return ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"][theDate.getMonth()] + " " +
theDate.getDate() + ", " +
theDate.getFullYear();
}
return (
<ul className="recent-posts">
{
Expand All @@ -74,7 +71,7 @@ var LatestPosts = React.createClass({
<li key={i}>
<a className="post-title">{post.title}</a>
<time className="published" title={post.publishedDate} dateTime={post.publishedDate}>
<span>{formatDate(new Date(post.publishedDate))}</span>
<span>{moment(post.publishedDate).format("MMM DD, YYYY")}</span>
</time>
</li>
)
Expand Down Expand Up @@ -189,7 +186,7 @@ var HomePage = React.createClass({
<div className="inner-container">
<IconLinks>
<IconLink
href="https://twitter.com/webmaker"
href={config.TWITTER_LINK}
imgSrc="/img/pages/about/svg/icon-twitter-blue.svg"
imgAlt=""
head="Follow Us"
Expand Down

0 comments on commit 280c772

Please sign in to comment.