mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
creatClass codemod
Reviewed By: sebmarkbage Differential Revision: D5484225 fbshipit-source-id: dc1414862e5823d1aa925f27a68f596ada627b48
This commit is contained in:
committed by
Facebook Github Bot
parent
f445ac8ef1
commit
fca30005a2
@@ -13,8 +13,15 @@
|
||||
var Metadata = require('Metadata');
|
||||
var React = require('React');
|
||||
|
||||
var DocsSidebar = React.createClass({
|
||||
getCategories: function() {
|
||||
class DocsSidebar extends React.Component {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this.getCategories = this.getCategories.bind(this);
|
||||
this.getLink = this.getLink.bind(this);
|
||||
}
|
||||
|
||||
getCategories() {
|
||||
var metadatas = Metadata.files.filter(function(metadata) {
|
||||
return metadata.layout === 'docs' || metadata.layout === 'autodocs';
|
||||
});
|
||||
@@ -67,13 +74,13 @@ var DocsSidebar = React.createClass({
|
||||
categories.push(currentCategory);
|
||||
|
||||
return categories;
|
||||
},
|
||||
}
|
||||
|
||||
getLink: function(metadata) {
|
||||
getLink(metadata) {
|
||||
return metadata.permalink;
|
||||
},
|
||||
}
|
||||
|
||||
render: function() {
|
||||
render() {
|
||||
return <div className="nav-docs">
|
||||
<div className="nav-docs-viewport">
|
||||
{this.getCategories().map((category) =>
|
||||
@@ -97,6 +104,6 @@ var DocsSidebar = React.createClass({
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = DocsSidebar;
|
||||
|
||||
Reference in New Issue
Block a user