0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-19 07:42:42 +00:00

Homebrew first pass is done

This commit is contained in:
Scott Tolksdorf
2015-12-17 22:15:03 -05:00
parent f968421b5b
commit 1c920e66c0
12 changed files with 589 additions and 241 deletions

View File

@@ -2,36 +2,49 @@ var React = require('react');
var _ = require('lodash');
var cx = require('classnames');
var PHB = require('./phb/phb.jsx');
var Editor = require('./editor/editor.jsx');
var Snippets = require('./editor/snippets');
var KEY = 'naturalCrit-homebrew';
var Markdown = require('marked');
var Homebrew = React.createClass({
getInitialState: function() {
return {
text : "# test \nneato"
text : Snippets.intro
};
},
handleTextChange : function(e){
componentDidMount: function() {
var storage = localStorage.getItem(KEY);
if(storage){
this.setState({
text : storage
})
}
},
console.log(e.value);
handleTextChange : function(text){
this.setState({
text : e.target.value
})
text : text
});
localStorage.setItem(KEY, text);
},
render : function(){
var self = this;
console.log(this.state.text);
return(
<div className='homebrew'>
<textarea value={this.state.text} onChange={this.handleTextChange} />
<div className='phb' dangerouslySetInnerHTML={{__html:Markdown(this.state.text)}} />
<Editor text={this.state.text} onChange={this.handleTextChange} />
<PHB text={this.state.text} />
</div>
);
}