-
Notifications
You must be signed in to change notification settings - Fork 4k
Sprite selector, CSS and Redux overhaul #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rschamp
merged 12 commits into
scratchfoundation:master
from
rschamp:feature/sprite-selector
Dec 12, 2016
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e3b0069
Refactor libraries to be a part of SpriteSelector
865a291
Add custom sprite selector with costume display
ccc8a1e
Don't use node rules in src/ eslint config
24389c3
Reduxify sprite selector
3cea22a
Fix editingTarget selection
cf85a3b
Reduxify modals
b29670b
Split stage selection from sprites
d139609
Style pass
16fbb64
Use CSS modules for styles
7542f1b
Give GUIComponent responsibility of children
5256237
Make ...rest syntax consistent.
bd99101
Sprites always have costume data now
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| .blocks { | ||
| position: absolute; | ||
| top: 40px; | ||
| right: 500px; | ||
| bottom: 0; | ||
| left: 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| .green-flag { | ||
| position: absolute; | ||
| top: 8px; | ||
| right: calc(480px - 16px); | ||
| width: 16px; | ||
| height: 16px; | ||
| } | ||
|
|
||
| .active { | ||
| filter: saturate(200%) brightness(150%); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| .gui { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 4px; | ||
| bottom: 0; | ||
| left: 4px; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| const defaultsDeep = require('lodash.defaultsdeep'); | ||
| const React = require('react'); | ||
| const VM = require('scratch-vm'); | ||
|
|
||
| const MediaLibrary = require('../../lib/media-library'); | ||
| const shapeFromPropTypes = require('../../lib/shape-from-prop-types'); | ||
|
|
||
| const Blocks = require('../../containers/blocks.jsx'); | ||
| const GreenFlag = require('../../containers/green-flag.jsx'); | ||
| const TargetPane = require('../../containers/target-pane.jsx'); | ||
| const Stage = require('../../containers/stage.jsx'); | ||
| const StopAll = require('../../containers/stop-all.jsx'); | ||
|
|
||
| const styles = require('./gui.css'); | ||
|
|
||
| const GUIComponent = props => { | ||
| let { | ||
| basePath, | ||
| blocksProps, | ||
| children, | ||
| greenFlagProps, | ||
| mediaLibrary, | ||
| targetPaneProps, | ||
| stageProps, | ||
| stopAllProps, | ||
| vm | ||
| } = props; | ||
| blocksProps = defaultsDeep({}, blocksProps, { | ||
| options: { | ||
| media: `${basePath}static/blocks-media/` | ||
| } | ||
| }); | ||
| if (children) { | ||
| return ( | ||
| <div className={styles.gui}> | ||
| {children} | ||
| </div> | ||
| ); | ||
| } | ||
| return ( | ||
| <div className={styles.gui}> | ||
| <GreenFlag | ||
| vm={vm} | ||
| {...greenFlagProps} | ||
| /> | ||
| <StopAll | ||
| vm={vm} | ||
| {...stopAllProps} | ||
| /> | ||
| <Stage | ||
| vm={vm} | ||
| {...stageProps} | ||
| /> | ||
| <TargetPane | ||
| mediaLibrary={mediaLibrary} | ||
| vm={vm} | ||
| {...targetPaneProps} | ||
| /> | ||
| <Blocks | ||
| vm={vm} | ||
| {...blocksProps} | ||
| /> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| GUIComponent.propTypes = { | ||
| basePath: React.PropTypes.string, | ||
| blocksProps: shapeFromPropTypes(Blocks.propTypes, {omit: ['vm']}), | ||
| children: React.PropTypes.node, | ||
| greenFlagProps: shapeFromPropTypes(GreenFlag.propTypes, {omit: ['vm']}), | ||
| mediaLibrary: React.PropTypes.instanceOf(MediaLibrary), | ||
| stageProps: shapeFromPropTypes(Stage.propTypes, {omit: ['vm']}), | ||
| stopAllProps: shapeFromPropTypes(StopAll.propTypes, {omit: ['vm']}), | ||
| targetPaneProps: shapeFromPropTypes(TargetPane.propTypes, {omit: ['vm']}), | ||
| vm: React.PropTypes.instanceOf(VM) | ||
| }; | ||
|
|
||
| GUIComponent.defaultProps = { | ||
| basePath: '/', | ||
| blocksProps: {}, | ||
| greenFlagProps: {}, | ||
| mediaLibrary: new MediaLibrary(), | ||
| targetPaneProps: {}, | ||
| stageProps: {}, | ||
| stopAllProps: {}, | ||
| vm: new VM() | ||
| }; | ||
|
|
||
| module.exports = GUIComponent; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| .library-item { | ||
| float: left; | ||
| width: 140px; | ||
| margin-left: 5px; | ||
| margin-right: 5px; | ||
| text-align: center; | ||
| cursor: pointer; | ||
| } | ||
| .library-item.is-selected { | ||
| background: #aaa; | ||
| border-radius: 6px; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| const classNames = require('classnames'); | ||
| const bindAll = require('lodash.bindall'); | ||
| const React = require('react'); | ||
|
|
||
| const CostumeCanvas = require('../costume-canvas/costume-canvas.jsx'); | ||
| const styles = require('./library-item.css'); | ||
|
|
||
| class LibraryItem extends React.Component { | ||
| constructor (props) { | ||
| super(props); | ||
| bindAll(this, ['handleClick']); | ||
| } | ||
| handleClick (e) { | ||
| this.props.onSelect(this.props.id); | ||
| e.preventDefault(); | ||
| } | ||
| render () { | ||
| return ( | ||
| <div | ||
| className={classNames({ | ||
| [styles.libraryItem]: true, | ||
| [styles.isSelected]: this.props.selected | ||
| })} | ||
| onClick={this.handleClick} | ||
| > | ||
| <CostumeCanvas url={this.props.iconURL} /> | ||
| <p>{this.props.name}</p> | ||
| </div> | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| LibraryItem.propTypes = { | ||
| iconURL: React.PropTypes.string, | ||
| id: React.PropTypes.number, | ||
| name: React.PropTypes.string, | ||
| onSelect: React.PropTypes.func, | ||
| selected: React.PropTypes.bool | ||
| }; | ||
|
|
||
| module.exports = LibraryItem; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| .library-scroll-grid { | ||
| overflow: scroll; | ||
| position: absolute; | ||
| top: 70px; | ||
| bottom: 20px; | ||
| left: 30px; | ||
| right: 30px; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as abuse.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.