add placeholders inside preferences

This commit is contained in:
mathuramg 2016-06-17 14:31:33 -04:00
parent 92e5e4e599
commit de165bbe19
9 changed files with 51 additions and 17 deletions

View file

@ -6,13 +6,15 @@ var classNames = require('classnames');
class Preferences extends React.Component { class Preferences extends React.Component {
render() { render() {
let preferencesButtonClass = classNames({ let preferencesContainerClass = classNames({
"preferences": true, "preferences": true,
"preferences--selected": this.props.isPreferencesShowing "preferences--selected": this.props.isPreferencesShowing
}); });
return ( return (
<div className={preferencesButtonClass}> <div className={preferencesContainerClass}>
GIANT POTATO <button className="preferences__exit-button" onClick={this.props.closePreferences}>
X
</button>
</div> </div>
); );
} }

View file

@ -31,7 +31,7 @@ class Toolbar extends React.Component {
<button className={stopButtonClass} onClick={this.props.stopSketch}> <button className={stopButtonClass} onClick={this.props.stopSketch}>
<Isvg src={stopUrl} alt="Stop Sketch" /> <Isvg src={stopUrl} alt="Stop Sketch" />
</button> </button>
<button className={preferencesButtonClass} onClick={this.props.togglePreferences}> <button className={preferencesButtonClass} onClick={this.props.openPreferences}>
<Isvg src={preferencesUrl} alt="Show Preferences" /> <Isvg src={preferencesUrl} alt="Show Preferences" />
</button> </button>
</div> </div>

View file

@ -17,7 +17,7 @@ class App extends React.Component {
isPlaying={this.props.ide.isPlaying} isPlaying={this.props.ide.isPlaying}
startSketch={this.props.startSketch} startSketch={this.props.startSketch}
stopSketch={this.props.stopSketch} stopSketch={this.props.stopSketch}
togglePreferences={this.props.togglePreferences} openPreferences={this.props.openPreferences}
isPreferencesShowing = {this.props.preferences.isPreferencesShowing} isPreferencesShowing = {this.props.preferences.isPreferencesShowing}
/> />
<Editor <Editor
@ -30,7 +30,8 @@ class App extends React.Component {
} }
isPlaying={this.props.ide.isPlaying}/> isPlaying={this.props.ide.isPlaying}/>
<Preferences <Preferences
isPreferencesShowing = {this.props.preferences.isPreferencesShowing}/> isPreferencesShowing = {this.props.preferences.isPreferencesShowing}
closePreferences={this.props.closePreferences}/>
</div> </div>
); );
} }

View file

@ -26,8 +26,14 @@ export function stopSketch() {
} }
} }
export function togglePreferences() { export function openPreferences() {
return { return {
type: ActionTypes.TOGGLE_PREFERENCES type: ActionTypes.OPEN_PREFERENCES
}
}
export function closePreferences() {
return {
type: ActionTypes.CLOSE_PREFERENCES
} }
} }

View file

@ -4,4 +4,5 @@ export const TOGGLE_SKETCH = 'TOGGLE_SKETCH';
export const START_SKETCH = 'START_SKETCH'; export const START_SKETCH = 'START_SKETCH';
export const STOP_SKETCH = 'STOP_SKETCH'; export const STOP_SKETCH = 'STOP_SKETCH';
export const TOGGLE_PREFERENCES = 'TOGGLE_PREFERENCES'; export const OPEN_PREFERENCES = 'OPEN_PREFERENCES';
export const CLOSE_PREFERENCES = 'CLOSE_PREFERENCES';

View file

@ -6,9 +6,13 @@ const initialState = {
const preferences = (state = initialState, action) => { const preferences = (state = initialState, action) => {
switch (action.type) { switch (action.type) {
case ActionTypes.TOGGLE_PREFERENCES: case ActionTypes.OPEN_PREFERENCES:
return { return {
isPreferencesShowing: !state.isPreferencesShowing isPreferencesShowing: true
}
case ActionTypes.CLOSE_PREFERENCES:
return {
isPreferencesShowing: false
} }
default: default:
return state return state

View file

@ -35,3 +35,4 @@ $dark-button-active-color: $white;
$editor-border-color: #f4f4f4; $editor-border-color: #f4f4f4;
$editor-selected-line-color: #f3f3f3; $editor-selected-line-color: #f3f3f3;
$preferences-background-color: #f4f4f4;

View file

@ -1,10 +1,21 @@
.preferences { .preferences {
position: absolute; background-color: $preferences-background-color;
right: 0;
top:0;
display: none; display: none;
&--selected {
display: flex;
}
} }
.preferences--selected { .preferences__exit-button {
display: block; background-color: $light-button-background-color;
color: $light-button-color;
display: inline-block;
height: #{44 / $base-font-size}rem;
width: #{44 / $base-font-size}rem;
text-align: center;
line-height: #{50 / $base-font-size}rem;
cursor: pointer;
border: none;
outline: none;
margin-left: auto;
} }

View file

@ -16,4 +16,12 @@
.toolbar { .toolbar {
width: 100%; width: 100%;
} }
.preferences {
width: 30%;
height: 50%;
position: absolute;
top: #{20 / $base-font-size}rem;
right:#{60 / $base-font-size}rem;
}