-
Notifications
You must be signed in to change notification settings - Fork 62
/
index.js
48 lines (43 loc) · 1.42 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React, { Component } from 'react'
import IDEEditor from 'components/IDEEditor'
import IDEConsole from 'components/IDEConsole'
import { connect } from 'react-redux'
import PropTypes from 'prop-types'
import { actions as editorActions } from 'features/Editor'
import { darkTheme } from 'theme'
import { MuiThemeProvider } from '@material-ui/core/styles'
import { ThemeProvider as StyledComponentsThemeProvider } from 'styled-components'
export class IDE extends Component {
static propTypes = {
code: PropTypes.string,
postCode: PropTypes.func,
getCode: PropTypes.func,
editorChanged: PropTypes.func,
logs: PropTypes.arrayOf(PropTypes.object)
}
render () {
return (
<StyledComponentsThemeProvider theme={darkTheme}>
<MuiThemeProvider theme={darkTheme}>
<IDEEditor
code={this.props.code}
postCode={this.props.postCode}
getCode={this.props.getCode}
editorChanged={this.props.editorChanged}
/>
<IDEConsole logs={this.props.logs} />
</MuiThemeProvider>
</StyledComponentsThemeProvider>
)
}
}
const mapStateToProps = state => ({
code: state.editor.code,
logs: state.consoleLog.logs
})
const mapDispatchToProps = {
getCode: editorActions.getCodeRequest,
editorChanged: editorActions.keyPressed,
postCode: editorActions.postCodeRequest
}
export default connect(mapStateToProps, mapDispatchToProps)(IDE)