web: CodeArea
This commit is contained in:
parent
10b1864680
commit
d4aec19c71
@ -5,10 +5,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
</div>
|
</div>
|
||||||
Type your source code into here:
|
|
||||||
<textarea class="code-input">
|
|
||||||
|
|
||||||
</textarea>
|
|
||||||
<script src="bundle.js"></script>
|
<script src="bundle.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,10 +1,37 @@
|
|||||||
const React = require("react");
|
const React = require("react");
|
||||||
const ReactDOM = require("react-dom");
|
const ReactDOM = require("react-dom");
|
||||||
|
|
||||||
|
|
||||||
|
class CodeArea extends React.Component {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {value: ""};
|
||||||
|
this.handleChange = this.handleChange.bind(this);
|
||||||
|
this.submit = this.submit.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleChange(event) {
|
||||||
|
this.setState({value: event.target.value});
|
||||||
|
}
|
||||||
|
|
||||||
|
submit(event) {
|
||||||
|
console.log("This", this.state.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (<div>
|
||||||
|
<textarea value={ this.state.value } onChange={this.handleChange}>
|
||||||
|
</textarea>
|
||||||
|
<button onClick={ this.submit }>Run!</button>
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const main = (<div>
|
const main = (<div>
|
||||||
<h1>Schala web input</h1>
|
<h1>Schala web input</h1>
|
||||||
<p>Write your source code here</p>
|
<p>Write your source code here</p>
|
||||||
|
<CodeArea/>
|
||||||
</div>);
|
</div>);
|
||||||
|
|
||||||
const rootDom = document.getElementById("main");
|
const rootDom = document.getElementById("main");
|
||||||
ReactDOM.render(<h1>Schala web input</h1>, rootDom);
|
ReactDOM.render(main, rootDom);
|
||||||
|
Loading…
Reference in New Issue
Block a user