Skip to content

Commit

Permalink
re-order App.js code
Browse files Browse the repository at this point in the history
  • Loading branch information
collardeau committed May 7, 2015
1 parent e61100e commit d8de3f5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
59 changes: 29 additions & 30 deletions app/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require('normalize.css/normalize.css');
require('./styles/main.scss');

const React = require('react');
const authUtils = require('./utils/authUtils');

// top level components for layouts
let Navigation = require('./components/Navigation');
Expand All @@ -11,41 +10,13 @@ let ListContainer = require('./components/list/ListContainer');
let Login = require('./components/login/Login');
let Account = require('./components/Account');

let homeRoute = (
<div>
<Navigation />
<Home />
</div>
);

let listRoute = (
<div>
<Navigation />
<ListContainer />
</div>
);

let loginRoute = (
<div>
<Navigation />
<Login />
</div>
);

let accountRoute = (
<div>
<Navigation />
<Account />
</div>
);

class App extends React.Component {

render() {

let ui = null;

switch(this.props.route) { // current hash is given to you
switch(this.props.route) {

case "home":
ui = homeRoute;
Expand All @@ -72,4 +43,32 @@ class App extends React.Component {
}
}

let homeRoute = (
<div>
<Navigation />
<Home />
</div>
);

let listRoute = (
<div>
<Navigation />
<ListContainer />
</div>
);

let loginRoute = (
<div>
<Navigation />
<Login />
</div>
);

let accountRoute = (
<div>
<Navigation />
<Account />
</div>
);

module.exports = App;
4 changes: 2 additions & 2 deletions app/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
const React = require('react');

class Welcome extends React.Component {
class Home extends React.Component {

constructor() {
super();
Expand Down Expand Up @@ -54,4 +54,4 @@ class Welcome extends React.Component {

}

module.exports = Welcome;
module.exports = Home;

0 comments on commit d8de3f5

Please sign in to comment.