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:
46
client/homebrew/homePage/homePage.jsx
Normal file
46
client/homebrew/homePage/homePage.jsx
Normal 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;
|
||||
3
client/homebrew/homePage/homePage.less
Normal file
3
client/homebrew/homePage/homePage.less
Normal file
@@ -0,0 +1,3 @@
|
||||
.homePage{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user