-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added basic routing and have begun piecing together componest in a us…
…eable way
- Loading branch information
zack
committed
Feb 9, 2015
1 parent
3ca1aa7
commit ddd58ae
Showing
4 changed files
with
88 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var React = require('react'); | ||
var request = require('superagent'); | ||
var LoadButton = require('./load-button.component.js'); | ||
|
||
var IssueList = React.createClass({ | ||
render: function () { | ||
var issues = this.props.issues; | ||
return ( | ||
<div className="card"> | ||
<form> | ||
<button onClick={this.loadIssues}>load Issues</button> | ||
</form> | ||
<pre>{issues}</pre> | ||
<div className="title">lithe</div> | ||
</div> | ||
); | ||
}, | ||
loadIssues: function () { | ||
console.log('here'); | ||
var url = 'http://www.constellates.com:8888/issue'; | ||
var self = this; | ||
request.get(url, function (res) { | ||
self.props.issues = res.body; | ||
console.log(res); | ||
}); | ||
} | ||
}); | ||
|
||
module.exports = IssueList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,51 @@ | ||
var SignInCard = require('./components/signin.component'); | ||
var IssueCard = require('./components/issue-form.component'); | ||
var React = require('react'); | ||
|
||
React.render( | ||
<SignInCard />, | ||
document.getElementById('main') | ||
); | ||
// dependencies ---------------------------------------------------------- | ||
|
||
var React = require('react'); | ||
Router = require('react-router'), | ||
DefaultRoute = Router.DefaultRoute, | ||
Link = Router.Link, | ||
Route = Router.Route, | ||
RouteHandler = Router.RouteHandler; | ||
|
||
// components ------------------------------------------------------------ | ||
|
||
var SignInCard = require('./components/signin.component'), | ||
IssueCard = require('./components/issue-form.component'), | ||
IssueList = require('./components/issue-list.component'); | ||
|
||
// parent view ----------------------------------------------------------- | ||
|
||
var App = React.createClass({ | ||
render: function () { | ||
return ( | ||
<div> | ||
<header> | ||
<ul> | ||
<li><Link to="inbox">sign in</Link></li> | ||
<li><Link to="calendar">create issue</Link></li> | ||
<li><Link to="issues">issues</Link></li> | ||
</ul> | ||
</header> | ||
|
||
<RouteHandler/> | ||
</div> | ||
) | ||
} | ||
}); | ||
|
||
// routes ---------------------------------------------------------------- | ||
|
||
var routes = ( | ||
<Route name="app" path="/" handler={App}> | ||
<Route name="inbox" handler={SignInCard}/> | ||
<Route name="calendar" handler={IssueCard}/> | ||
<Route name="issues" handler={IssueList}/> | ||
<DefaultRoute handler={SignInCard}/> | ||
</Route> | ||
); | ||
|
||
// render handler -------------------------------------------------------- | ||
|
||
Router.run(routes, function (Handler) { | ||
React.render(<Handler/>, document.getElementById('main')); | ||
}); |