0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-18 14:22:42 +00:00

Added the new pages and router

This commit is contained in:
Scott Tolksdorf
2015-12-20 13:16:57 -05:00
parent 0a9143bcd4
commit 3059586e20
11 changed files with 152 additions and 45 deletions

View File

@@ -0,0 +1,46 @@
var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var PHB = require('../phb/phb.jsx');
var Editor = require('../editor/editor.jsx');
var KEY = 'naturalCrit-homebrew';
var HomePage = React.createClass({
getInitialState: function() {
return {
text: "# Welcome"
};
},
componentDidMount: function() {
var storage = localStorage.getItem(KEY);
if(storage){
this.setState({
text : storage
})
}
},
handleTextChange : function(text){
this.setState({
text : text
});
localStorage.setItem(KEY, text);
},
render : function(){
var self = this;
return(
<div className='homePage'>
<Editor text={this.state.text} onChange={this.handleTextChange} />
<PHB text={this.state.text} />
</div>
);
}
});
module.exports = HomePage;

View File

@@ -0,0 +1,3 @@
.homePage{
}