File tree Expand file tree Collapse file tree 9 files changed +51
-17
lines changed Expand file tree Collapse file tree 9 files changed +51
-17
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,15 @@ var classNames = require('classnames');
6
6
7
7
class Preferences extends React . Component {
8
8
render ( ) {
9
- let preferencesButtonClass = classNames ( {
9
+ let preferencesContainerClass = classNames ( {
10
10
"preferences" : true ,
11
11
"preferences--selected" : this . props . isPreferencesShowing
12
12
} ) ;
13
13
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 >
16
18
</ div >
17
19
) ;
18
20
}
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class Toolbar extends React.Component {
31
31
< button className = { stopButtonClass } onClick = { this . props . stopSketch } >
32
32
< Isvg src = { stopUrl } alt = "Stop Sketch" />
33
33
</ button >
34
- < button className = { preferencesButtonClass } onClick = { this . props . togglePreferences } >
34
+ < button className = { preferencesButtonClass } onClick = { this . props . openPreferences } >
35
35
< Isvg src = { preferencesUrl } alt = "Show Preferences" />
36
36
</ button >
37
37
</ div >
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class App extends React.Component {
17
17
isPlaying = { this . props . ide . isPlaying }
18
18
startSketch = { this . props . startSketch }
19
19
stopSketch = { this . props . stopSketch }
20
- togglePreferences = { this . props . togglePreferences }
20
+ openPreferences = { this . props . openPreferences }
21
21
isPreferencesShowing = { this . props . preferences . isPreferencesShowing }
22
22
/>
23
23
< Editor
@@ -30,7 +30,8 @@ class App extends React.Component {
30
30
}
31
31
isPlaying = { this . props . ide . isPlaying } />
32
32
< Preferences
33
- isPreferencesShowing = { this . props . preferences . isPreferencesShowing } />
33
+ isPreferencesShowing = { this . props . preferences . isPreferencesShowing }
34
+ closePreferences = { this . props . closePreferences } />
34
35
</ div >
35
36
) ;
36
37
}
Original file line number Diff line number Diff line change @@ -26,8 +26,14 @@ export function stopSketch() {
26
26
}
27
27
}
28
28
29
- export function togglePreferences ( ) {
29
+ export function openPreferences ( ) {
30
30
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
32
38
}
33
39
}
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ export const TOGGLE_SKETCH = 'TOGGLE_SKETCH';
4
4
export const START_SKETCH = 'START_SKETCH' ;
5
5
export const STOP_SKETCH = 'STOP_SKETCH' ;
6
6
7
- export const TOGGLE_PREFERENCES = 'TOGGLE_PREFERENCES' ;
7
+ export const OPEN_PREFERENCES = 'OPEN_PREFERENCES' ;
8
+ export const CLOSE_PREFERENCES = 'CLOSE_PREFERENCES' ;
Original file line number Diff line number Diff line change @@ -6,9 +6,13 @@ const initialState = {
6
6
7
7
const preferences = ( state = initialState , action ) => {
8
8
switch ( action . type ) {
9
- case ActionTypes . TOGGLE_PREFERENCES :
9
+ case ActionTypes . OPEN_PREFERENCES :
10
10
return {
11
- isPreferencesShowing : ! state . isPreferencesShowing
11
+ isPreferencesShowing : true
12
+ }
13
+ case ActionTypes . CLOSE_PREFERENCES :
14
+ return {
15
+ isPreferencesShowing : false
12
16
}
13
17
default :
14
18
return state
Original file line number Diff line number Diff line change @@ -35,3 +35,4 @@ $dark-button-active-color: $white;
35
35
$editor-border-color : #f4f4f4 ;
36
36
$editor-selected-line-color : #f3f3f3 ;
37
37
38
+ $preferences-background-color : #f4f4f4 ;
Original file line number Diff line number Diff line change 1
1
.preferences {
2
- position : absolute ;
3
- right : 0 ;
4
- top :0 ;
2
+ background-color : $preferences-background-color ;
5
3
display : none ;
4
+ & --selected {
5
+ display : flex ;
6
+ }
6
7
}
7
8
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 ;
10
21
}
Original file line number Diff line number Diff line change 16
16
17
17
.toolbar {
18
18
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
+ }
You can’t perform that action at this time.
0 commit comments