From 525925691b49dfe3c1b64a763370394a68d5748b Mon Sep 17 00:00:00 2001 From: Gregory Eremin <g@erem.in> Date: Sat, 7 Mar 2015 15:34:35 +0700 Subject: [PATCH] Menu react component --- .gitignore | 1 + server/app/app.jsx | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 server/app/app.jsx diff --git a/.gitignore b/.gitignore index 87f58f1..81a7df3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ config.json *.txt +server/app/.module-cache diff --git a/server/app/app.jsx b/server/app/app.jsx new file mode 100644 index 0000000..06fe073 --- /dev/null +++ b/server/app/app.jsx @@ -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> + ); + } +});