Menu react component
This commit is contained in:
		
							parent
							
								
									9e00ad1c15
								
							
						
					
					
						commit
						525925691b
					
				
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,2 +1,3 @@
 | 
			
		||||
config.json
 | 
			
		||||
*.txt
 | 
			
		||||
server/app/.module-cache
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										32
									
								
								server/app/app.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								server/app/app.jsx
									
									
									
									
									
										Normal 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>
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user