docusaurus/lib/core/BlogSidebar.js

42 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-07-07 13:28:29 -04:00
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
2017-07-07 13:28:29 -04:00
*/
const React = require('react');
const Container = require('./Container.js');
const SideNav = require('./nav/SideNav.js');
2017-07-07 13:28:29 -04:00
const MetadataBlog = require('./MetadataBlog.js');
2017-07-07 13:28:29 -04:00
class BlogSidebar extends React.Component {
render() {
2017-07-10 19:38:35 -04:00
const contents = [
{
name: 'Recent Posts',
links: MetadataBlog.slice(0, 5),
},
2017-07-10 19:38:35 -04:00
];
2017-07-07 13:28:29 -04:00
const title = this.props.current && this.props.current.title;
const current = {
id: title || '',
category: 'Recent Posts',
2017-07-07 13:28:29 -04:00
};
return (
<Container className="docsNavContainer" id="docsNav" wrapper={false}>
<SideNav
language={this.props.language}
root={this.props.config.baseUrl + 'blog/'}
2017-07-07 13:28:29 -04:00
title="Blog"
contents={contents}
current={current}
/>
</Container>
);
}
}
module.exports = BlogSidebar;