0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-04 21:12:41 +00:00
Files
homebrewery/client/homebrew/homePage/homePage.jsx
2016-01-05 16:41:19 -05:00

59 lines
1.2 KiB
JavaScript

var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var Statusbar = require('../statusbar/statusbar.jsx');
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 \n Oh god, what to put here. *Instructions* I guess?."
};
},
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'>
<Statusbar />
<div className='paneSplit'>
<div className='leftPane'>
<Editor text={this.state.text} onChange={this.handleTextChange} />
</div>
<div className='rightPane'>
<PHB text={this.state.text} />
</div>
</div>
<a href='/homebrew/new' className='floatingNewButton'>
Create your own <i className='fa fa-magic' />
</a>
</div>
);
}
});
module.exports = HomePage;