2016-03-24 21:10:15 +00:00
|
|
|
/**
|
|
|
|
* 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 BlogPageLayout
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('React');
|
|
|
|
var Site = require('Site');
|
2016-11-02 12:31:52 +00:00
|
|
|
var Hero = require('Hero');
|
|
|
|
var MetadataBlog = require('MetadataBlog');
|
|
|
|
var BlogPost = require('BlogPost');
|
|
|
|
var BlogPostExcerpt = require('BlogPostExcerpt');
|
2016-03-24 21:10:15 +00:00
|
|
|
|
|
|
|
var BlogPageLayout = React.createClass({
|
|
|
|
getPageURL: function(page) {
|
2016-09-05 21:23:54 +00:00
|
|
|
var url = '/react-native/blog/';
|
2016-03-24 21:10:15 +00:00
|
|
|
if (page > 0) {
|
|
|
|
url += 'page' + (page + 1) + '/';
|
|
|
|
}
|
|
|
|
return url + '#content';
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
var perPage = this.props.metadata.perPage;
|
|
|
|
var page = this.props.metadata.page;
|
|
|
|
return (
|
|
|
|
<Site
|
|
|
|
section="blog"
|
2016-08-30 17:56:48 +00:00
|
|
|
title="React Native Blog"
|
|
|
|
description="The best place to stay up-to-date with the latest React Native news and events.">
|
2016-11-02 12:31:52 +00:00
|
|
|
<Hero title="React Native Blog" subtitle="Stay up-to-date with the latest React Native news and events." />
|
2016-03-24 21:10:15 +00:00
|
|
|
<section className="content wrap documentationContent">
|
|
|
|
{MetadataBlog.files
|
|
|
|
.slice(page * perPage, (page + 1) * perPage)
|
|
|
|
.map((post) => {
|
2016-08-23 18:59:26 +00:00
|
|
|
return (
|
2016-11-02 12:31:52 +00:00
|
|
|
<BlogPostExcerpt post={post} />
|
2016-08-23 18:59:26 +00:00
|
|
|
)
|
2016-03-24 21:10:15 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
<div className="docs-prevnext">
|
2016-11-02 12:31:52 +00:00
|
|
|
{page > 0 &&
|
2016-11-05 06:30:44 +00:00
|
|
|
<a className="docs-prev" href={this.getPageURL(page - 1)}>← Newer posts</a>}
|
|
|
|
{MetadataBlog.files.length > (page + 1) * perPage &&
|
|
|
|
<a className="docs-next" href={this.getPageURL(page + 1)}>Older posts →</a>}
|
2016-03-24 21:10:15 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</Site>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = BlogPageLayout;
|