Last active
June 30, 2016 18:36
-
-
Save akaHeimdall/e1f3c9dfe86750d003e1 to your computer and use it in GitHub Desktop.
react component for main app that loads announcement list
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
// App | |
// <App/> | |
import React from 'react'; | |
import Header from './Header'; | |
import SenderNav from './SenderNav'; | |
import Dashboard from './Dashboard'; | |
import AnnouncementsList from './Announcements/AnnouncementsList'; | |
// Firebase | |
import Rebase from 're-base'; | |
var base = Rebase.createClass('https://myappurl.firebaseio.com/'); | |
var App = React.createClass({ | |
getInitialState : function() { | |
return{ | |
contents : {}, | |
announcements : {} | |
} | |
}, | |
componentDidMount : function() { | |
base.syncState('contents', { | |
context: this, | |
state: 'contents' | |
}); | |
base.syncState('announcements', { | |
context: this, | |
state: 'announcements', | |
queries: { | |
orderByValue: 'created_at', | |
limitToLast: 1 | |
} | |
}); | |
}, | |
seedContent : function(event){ | |
this.setState({ | |
contents : require('../../loading/sample_content'), | |
announcements : require('../../loading/sample_announcements') | |
}); | |
console.log("seeded content"); | |
}, | |
render : function() { | |
return ( | |
<div id="container2"> | |
<Header/> | |
<SenderNav/> | |
<div className="row"> | |
<div className="col-md-12 center" align="center"> Errors & Notices will go here </div> | |
</div> | |
<div className="container-fluid"> | |
<div id=""> | |
<AnnouncementList | |
seedContent={this.seedContent} | |
announcements={this.state.announcements}/> | |
</div> | |
{/*<!-- footer -->*/} | |
</div> | |
</div> | |
) | |
} | |
}); | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment