Skip to content

Commit de165bb

Browse files
committed
add placeholders inside preferences
1 parent 92e5e4e commit de165bb

File tree

9 files changed

+51
-17
lines changed

9 files changed

+51
-17
lines changed

shared/components/Preferences/Preferences.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ var classNames = require('classnames');
66

77
class Preferences extends React.Component {
88
render() {
9-
let preferencesButtonClass = classNames({
9+
let preferencesContainerClass = classNames({
1010
"preferences": true,
1111
"preferences--selected": this.props.isPreferencesShowing
1212
});
1313
return (
14-
<div className={preferencesButtonClass}>
15-
GIANT POTATO
14+
<div className={preferencesContainerClass}>
15+
<button className="preferences__exit-button" onClick={this.props.closePreferences}>
16+
X
17+
</button>
1618
</div>
1719
);
1820
}

shared/components/Toolbar/Toolbar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Toolbar extends React.Component {
3131
<button className={stopButtonClass} onClick={this.props.stopSketch}>
3232
<Isvg src={stopUrl} alt="Stop Sketch" />
3333
</button>
34-
<button className={preferencesButtonClass} onClick={this.props.togglePreferences}>
34+
<button className={preferencesButtonClass} onClick={this.props.openPreferences}>
3535
<Isvg src={preferencesUrl} alt="Show Preferences" />
3636
</button>
3737
</div>

shared/containers/App/App.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class App extends React.Component {
1717
isPlaying={this.props.ide.isPlaying}
1818
startSketch={this.props.startSketch}
1919
stopSketch={this.props.stopSketch}
20-
togglePreferences={this.props.togglePreferences}
20+
openPreferences={this.props.openPreferences}
2121
isPreferencesShowing = {this.props.preferences.isPreferencesShowing}
2222
/>
2323
<Editor
@@ -30,7 +30,8 @@ class App extends React.Component {
3030
}
3131
isPlaying={this.props.ide.isPlaying}/>
3232
<Preferences
33-
isPreferencesShowing = {this.props.preferences.isPreferencesShowing}/>
33+
isPreferencesShowing = {this.props.preferences.isPreferencesShowing}
34+
closePreferences={this.props.closePreferences}/>
3435
</div>
3536
);
3637
}

shared/redux/actions/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,14 @@ export function stopSketch() {
2626
}
2727
}
2828

29-
export function togglePreferences() {
29+
export function openPreferences() {
3030
return {
31-
type: ActionTypes.TOGGLE_PREFERENCES
31+
type: ActionTypes.OPEN_PREFERENCES
32+
}
33+
}
34+
35+
export function closePreferences() {
36+
return {
37+
type: ActionTypes.CLOSE_PREFERENCES
3238
}
3339
}

shared/redux/constants/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ export const TOGGLE_SKETCH = 'TOGGLE_SKETCH';
44
export const START_SKETCH = 'START_SKETCH';
55
export const STOP_SKETCH = 'STOP_SKETCH';
66

7-
export const TOGGLE_PREFERENCES = 'TOGGLE_PREFERENCES';
7+
export const OPEN_PREFERENCES = 'OPEN_PREFERENCES';
8+
export const CLOSE_PREFERENCES = 'CLOSE_PREFERENCES';

shared/redux/reducers/preferences.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ const initialState = {
66

77
const preferences = (state = initialState, action) => {
88
switch (action.type) {
9-
case ActionTypes.TOGGLE_PREFERENCES:
9+
case ActionTypes.OPEN_PREFERENCES:
1010
return {
11-
isPreferencesShowing: !state.isPreferencesShowing
11+
isPreferencesShowing: true
12+
}
13+
case ActionTypes.CLOSE_PREFERENCES:
14+
return {
15+
isPreferencesShowing: false
1216
}
1317
default:
1418
return state

styles/abstracts/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ $dark-button-active-color: $white;
3535
$editor-border-color: #f4f4f4;
3636
$editor-selected-line-color: #f3f3f3;
3737

38+
$preferences-background-color: #f4f4f4;

styles/components/_preferences.scss

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
.preferences {
2-
position: absolute;
3-
right: 0;
4-
top:0;
2+
background-color: $preferences-background-color;
53
display: none;
4+
&--selected {
5+
display: flex;
6+
}
67
}
78

8-
.preferences--selected {
9-
display: block;
9+
.preferences__exit-button {
10+
background-color: $light-button-background-color;
11+
color: $light-button-color;
12+
display: inline-block;
13+
height: #{44 / $base-font-size}rem;
14+
width: #{44 / $base-font-size}rem;
15+
text-align: center;
16+
line-height: #{50 / $base-font-size}rem;
17+
cursor: pointer;
18+
border: none;
19+
outline: none;
20+
margin-left: auto;
1021
}

styles/layout/_ide.scss

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,12 @@
1616

1717
.toolbar {
1818
width: 100%;
19-
}
19+
}
20+
21+
.preferences {
22+
width: 30%;
23+
height: 50%;
24+
position: absolute;
25+
top: #{20 / $base-font-size}rem;
26+
right:#{60 / $base-font-size}rem;
27+
}

0 commit comments

Comments
 (0)