main
js 39 lines 813 Bytes
Raw
1 import React, {Component} from 'react';
2
3 class Editor extends Component {
4 constructor(props) {
5 super(props);
6 this.state = {
7 code: props.code,
8 };
9 }
10
11 render() {
12 return (
13 <div
14 style={{
15 height: '100%',
16 width: '100%',
17 }}>
18 <textarea
19 value={this.state.code}
20 onChange={e => this.setState({code: e.target.value})}
21 style={{
22 height: '80%',
23 width: '100%',
24 fontSize: '15px',
25 }}
26 />
27 <div style={{height: '20%', textAlign: 'center'}}>
28 <button
29 onClick={() => this.props.onClose(this.state.code)}
30 style={{fontSize: 'large'}}>
31 Run
32 </button>
33 </div>
34 </div>
35 );
36 }
37 }
38
39 export default Editor;