1
0
Fork 0

Menu react component

This commit is contained in:
Gregory Eremin 2015-03-07 15:34:35 +07:00
parent 9e00ad1c15
commit 525925691b
2 changed files with 33 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
config.json
*.txt
server/app/.module-cache

32
server/app/app.jsx Normal file
View File

@ -0,0 +1,32 @@
var Menu = React.createClass({
getInitialState: function() {
return {teams: []};
},
componentDidMount: function() {
this.loadTeams();
},
loadTeams: function() {
$.get(this.props.api, function(res){
this.setState({teams: res})
}.bind(this));
},
render: function() {
var renderTeam = function(team) {
return (
<li className="nav team">{team.name}</li>
)
};
return (
<ul>
<li className="nav empact">Empact</li>
<li className="nav dash">Dashboard</li>
<li className="nav repos">Repos</li>
<li className="nav header">Teams:</li>
{this.state.teams.map(renderTeam)}
</ul>
);
}
});