Skip to content

Commit 15e5352

Browse files
committed
added playground component
1 parent d107fc9 commit 15e5352

File tree

1 file changed

+40
-0
lines changed
  • docs/client/components/PlaygroundPage/PlaygroundWithPreview

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import React from 'react';
2+
import Editor from 'codemirror';
3+
import 'codemirror/lib/codemirror.css';
4+
import 'codemirror/mode/javascript/javascript';
5+
6+
import styles from './styles.scss';
7+
8+
import './editor.css';
9+
10+
class Playground extends React.Component {
11+
constructor(props) {
12+
super(props);
13+
14+
}
15+
16+
componentDidMount() {
17+
this.editor = Editor.fromTextArea(this.refs.editor, {
18+
mode: 'javascript',
19+
lineNumbers: false,
20+
smartIndent: false,
21+
tabSize: 2,
22+
matchBrackets: true,
23+
theme: 'custom',
24+
readOnly: false,
25+
});
26+
}
27+
28+
render() {
29+
return (
30+
<div className={styles.playground}>
31+
<textarea
32+
ref="editor"
33+
defaultValue={this.props.code}
34+
/>
35+
</div>
36+
);
37+
}
38+
}
39+
40+
export default Playground;

0 commit comments

Comments
 (0)