mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
b80698df1c
Summary:Ported the infrastructure from jest. ![screen shot 2016-03-24 at 9 47 50 am](https://cloud.githubusercontent.com/assets/197597/14024237/85db1132-f1a5-11e5-84be-f525e302c6ca.png) Closes https://github.com/facebook/react-native/pull/6629 Differential Revision: D3094423 Pulled By: vjeux fb-gh-sync-id: a01aec6a55d28484c45bb241d037ca6717bc5e81 shipit-source-id: a01aec6a55d28484c45bb241d037ca6717bc5e81
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule BlogPost
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var Marked = require('Marked');
|
|
var React = require('React');
|
|
|
|
var BlogPost = React.createClass({
|
|
render: function() {
|
|
var post = this.props.post;
|
|
var content = this.props.content;
|
|
|
|
var match = post.path.match(/([0-9]+)\/([0-9]+)\/([0-9]+)/);
|
|
// Because JavaScript sucks at date handling :(
|
|
var year = match[1];
|
|
var month = [
|
|
'January', 'February', 'March', 'April', 'May', 'June', 'July',
|
|
'August', 'September', 'October', 'November', 'December'
|
|
][parseInt(match[2], 10) - 1];
|
|
var day = parseInt(match[3], 10);
|
|
|
|
return (
|
|
<div>
|
|
<h1>{post.title}</h1>
|
|
<p className="meta">
|
|
{month} {day}, {year} by{' '}
|
|
<a href={post.authorURL} target="_blank">{post.author}</a>
|
|
</p>
|
|
<hr />
|
|
<Marked>{content}</Marked>
|
|
</div>
|
|
);
|
|
}
|
|
});
|
|
|
|
module.exports = BlogPost;
|