p5.js-web-editor/shared/containers/App/App.jsx

44 lines
1.2 KiB
React
Raw Normal View History

2016-05-06 01:01:31 +02:00
import React from 'react';
import Editor from '../../components/Editor/Editor'
2016-05-10 00:28:38 +02:00
import PreviewFrame from '../../components/Preview/PreviewFrame'
import Preview from '../../components/Preview/Preview'
2016-05-11 19:19:37 +02:00
import Toolbar from '../../components/Toolbar/Toolbar'
2016-05-06 01:01:31 +02:00
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import * as FileActions from '../../redux/actions'
class App extends React.Component {
render() {
return (
2016-05-11 04:22:32 +02:00
<div className="app">
2016-05-11 19:19:37 +02:00
<Toolbar
2016-05-11 22:13:17 +02:00
className="toolbar"
isPlaying={this.props.ide.isPlaying}
2016-05-12 23:40:49 +02:00
startSketch={this.props.startSketch}
stopSketch={this.props.stopSketch}/>
<Editor
content={this.props.file.content}
updateFile={this.props.updateFile} />
2016-05-11 04:22:32 +02:00
<PreviewFrame
content={this.props.file.content}
head={
<link type='text/css' rel='stylesheet' href='preview-styles.css' />
2016-05-11 22:13:17 +02:00
}
isPlaying={this.props.ide.isPlaying}/>
</div>
2016-05-06 01:01:31 +02:00
);
}
}
function mapStateToProps(state) {
return {
2016-05-11 22:13:17 +02:00
file: state.file,
ide: state.ide
2016-05-06 01:01:31 +02:00
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(FileActions, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(App);