react-native/website/core/BlogSidebar.js
Héctor Ramos 81864e1298 Fix broken link in blog page links.
Summary:
This fixes an issue that would have arised once our number of blog posts passed 10, as the prev/next links in the footer were using the wrong path ("jest/", instead of "react-native/").

I also capped the number of recent blog posts to 10 in the sidebar.
Closes https://github.com/facebook/react-native/pull/9670

Differential Revision: D3819973

Pulled By: mkonicek

fbshipit-source-id: 321fe99654e10a4ad3e0815540518c8e9202385f
2016-09-05 14:28:45 -07:00

43 lines
1.1 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 BlogSidebar
*/
'use strict';
var MetadataBlog = require('MetadataBlog');
var React = require('React');
var BlogSidebar = React.createClass({
render: function() {
return (
<div className="nav-docs">
<div className="nav-docs-section">
<h3>Recent Posts</h3>
<ul>
{MetadataBlog.files.slice(0,10).map(function(post) {
return (
<li key={post.path}>
<a
className={this.props.title === post.title ? 'active' : ''}
href={'/react-native/blog/' + post.path}>
{post.title}
</a>
</li>
);
}.bind(this))}
</ul>
</div>
</div>
);
}
});
module.exports = BlogSidebar;