File tree 3 files changed +21
-15
lines changed
3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,20 @@ width: 3rem;
11
11
}
12
12
` ;
13
13
14
- const IconButton = props => ( < ButtonWrapper
15
- iconBefore = { props . element }
16
- kind = { Button . kinds . inline }
17
- { ...props }
18
- /> ) ;
14
+ const IconButton = ( props ) => {
15
+ const { icon, ...otherProps } = props ;
16
+ const Icon = icon ;
17
+
18
+ return ( < ButtonWrapper
19
+ iconBefore = { < Icon /> }
20
+ kind = { Button . kinds . inline }
21
+ focusable = "false"
22
+ { ...otherProps }
23
+ /> ) ;
24
+ } ;
19
25
20
26
IconButton . propTypes = {
21
- element : PropTypes . element . isRequired
27
+ icon : PropTypes . func . isRequired
22
28
} ;
23
29
24
30
export default IconButton ;
Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ import { getHTMLFile } from '../reducers/files';
20
20
21
21
// Local Imports
22
22
import Editor from '../components/Editor' ;
23
- import { ExitIcon } from '../../../common/icons' ;
24
-
25
- import { PreferencesIcon , PlayIcon } from '../../../common/icons' ;
23
+ import { PreferencesIcon , PlayIcon , ExitIcon } from '../../../common/icons' ;
26
24
27
25
import IconButton from '../../../components/mobile/IconButton' ;
28
26
import Header from '../../../components/mobile/Header' ;
@@ -53,17 +51,19 @@ const IDEViewMobile = (props) => {
53
51
return (
54
52
< Screen >
55
53
< Header >
56
- < IconButton to = "/mobile" aria-label = "Return to original editor" >
57
- < ExitIcon viewBox = "0 0 16 16" />
58
- </ IconButton >
54
+ < IconButton to = "/mobile" icon = { ExitIcon } aria-label = "Return to original editor" />
59
55
< div style = { { marginLeft : '1rem' } } >
60
56
< h2 > { project . name } </ h2 >
61
57
< h3 > { selectedFile . name } </ h3 >
62
58
</ div >
63
59
64
60
< IconContainer >
65
- < IconButton onClick = { ( ) => setOverlay ( 'preferences' ) } element = { < PreferencesIcon focusable = "false" aria-hidden = "true" /> } />
66
- < IconButton to = "/mobile/preview" onClick = { ( ) => { startSketch ( ) ; } } element = { < PlayIcon viewBox = "-1 -1 7 7" focusable = "false" aria-hidden = "true" /> } />
61
+ < IconButton
62
+ onClick = { ( ) => setOverlay ( 'preferences' ) }
63
+ icon = { PreferencesIcon }
64
+ aria-label = "Open preferences menu"
65
+ />
66
+ < IconButton to = "/mobile/preview" onClick = { ( ) => { startSketch ( ) ; } } icon = { PlayIcon } aria-label = "Run sketch" />
67
67
</ IconContainer >
68
68
</ Header >
69
69
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ const MobileSketchView = (props) => {
50
50
return (
51
51
< Screen >
52
52
< Header >
53
- < IconButton to = "/mobile" element = { < ExitIcon /> } width = { 12 } height = { 12 } aria-label = "Return to original editor" />
53
+ < IconButton to = "/mobile" icon = { ExitIcon } aria-label = "Return to original editor" />
54
54
< div style = { { marginLeft : '1rem' } } >
55
55
< h2 > { projectName } </ h2 >
56
56
< h3 > < br /> </ h3 >
You can’t perform that action at this time.
0 commit comments