Skip to content
Snippets Groups Projects
Commit 5251b07e authored by Ray Schamp's avatar Ray Schamp
Browse files

Add "stop" skeleton component

parent 06ca90c8
No related branches found
No related tags found
No related merge requests found
...@@ -12,14 +12,19 @@ class GreenFlag extends React.Component { ...@@ -12,14 +12,19 @@ class GreenFlag extends React.Component {
render () { render () {
return ( return (
<div className="scratch-green-flag"> <div className="scratch-green-flag">
<button onClick={this.onClick}></button> <button onClick={this.onClick}>{this.props.title}</button>
</div> </div>
); );
} }
} }
GreenFlag.propTypes = { GreenFlag.propTypes = {
title: React.PropTypes.string,
vm: React.PropTypes.object vm: React.PropTypes.object
}; };
GreenFlag.defaultProps = {
title: 'Go'
};
module.exports = GreenFlag; module.exports = GreenFlag;
...@@ -5,6 +5,7 @@ const GreenFlag = require('./green-flag'); ...@@ -5,6 +5,7 @@ const GreenFlag = require('./green-flag');
const Renderer = require('scratch-render'); const Renderer = require('scratch-render');
const SpriteSelector = require('./sprite-selector'); const SpriteSelector = require('./sprite-selector');
const Stage = require('./stage'); const Stage = require('./stage');
const StopAll = require('./stop-all');
const Toolbox = require('./toolbox'); const Toolbox = require('./toolbox');
const VM = require('scratch-vm'); const VM = require('scratch-vm');
const VMManager = require('../lib/vm-manager'); const VMManager = require('../lib/vm-manager');
...@@ -40,6 +41,7 @@ class GUI extends React.Component { ...@@ -40,6 +41,7 @@ class GUI extends React.Component {
return ( return (
<div className="scratch-gui"> <div className="scratch-gui">
<GreenFlag vm={this.props.vm} /> <GreenFlag vm={this.props.vm} />
<StopAll vm={this.props.vm} />
<Stage stageRef={stage => this.stage = stage} /> <Stage stageRef={stage => this.stage = stage} />
<SpriteSelector vm={this.props.vm} /> <SpriteSelector vm={this.props.vm} />
<Toolbox toolboxRef={toolbox => this.toolbox = toolbox} /> <Toolbox toolboxRef={toolbox => this.toolbox = toolbox} />
......
const React = require('react');
class StopAll extends React.Component {
constructor (props) {
super(props);
this.onClick = this.onClick.bind(this);
}
onClick (e) {
e.preventDefault();
this.props.vm.stopAll();
}
render () {
return (
<div className="scratch-stop-all">
<button onClick={this.onClick}>{this.props.title}</button>
</div>
);
}
}
StopAll.propTypes = {
title: React.PropTypes.string,
vm: React.PropTypes.object
};
StopAll.defaultProps = {
title: 'Stop'
};
module.exports = StopAll;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment