@@ -20,93 +20,54 @@ import { getHTMLFile } from '../reducers/files';
2020
2121// Local Imports
2222import Editor from '../components/Editor' ;
23- import { prop , remSize } from '../../../theme' ;
24- import { ExitIcon } from '../../../common/icons' ;
25-
26- const background = prop ( 'Button.default.background' ) ;
27- const textColor = prop ( 'primaryTextColor' ) ;
28-
29-
30- const Header = styled . div `
31- position: fixed;
32- width: 100%;
33- background: ${ background } ;
34- color: ${ textColor } ;
35- padding: ${ remSize ( 12 ) } ;
36- padding-left: ${ remSize ( 32 ) } ;
37- padding-right: ${ remSize ( 32 ) } ;
38- z-index: 1;
39-
40- display: flex;
41- flex: 1;
42- flex-direction: row;
43- justify-content: flex-start;
44- align-items: center;
45- ` ;
46-
47- const Footer = styled . div `
48- position: fixed;
49- width: 100%;
50- background: ${ background } ;
51- color: ${ textColor } ;
52- padding: ${ remSize ( 12 ) } ;
53- padding-left: ${ remSize ( 32 ) } ;
54- z-index: 1;
55-
56- bottom: 0;
57- ` ;
58-
59- const Content = styled . div `
60- z-index: 0;
61- margin-top: ${ remSize ( 16 ) } ;
62- ` ;
23+ import { PreferencesIcon , PlayIcon , ExitIcon } from '../../../common/icons' ;
6324
64- const Icon = styled . a `
65- > svg {
66- fill: ${ textColor } ;
67- color: ${ textColor } ;
68- margin-left: ${ remSize ( 16 ) } ;
69- }
70- ` ;
25+ import IconButton from '../../../components/mobile/IconButton' ;
26+ import Header from '../../../components/mobile/Header' ;
27+ import Screen from '../../../components/mobile/MobileScreen' ;
28+ import Footer from '../../../components/mobile/Footer' ;
29+ import IDEWrapper from '../../../components/mobile/IDEWrapper' ;
30+ import { remSize } from '../../../theme' ;
7131
72- const IconLinkWrapper = styled ( Link ) `
73- width: 3rem;
74- margin-right: 1.25rem;
75- margin-left: none;
32+ const IconContainer = styled . div `
33+ margin-left: ${ remSize ( 32 ) } ;
34+ display: flex;
7635` ;
7736
78-
79- const Screen = ( { children } ) => (
80- < div className = "fullscreen-preview" >
81- { children }
82- </ div >
83- ) ;
84- Screen . propTypes = {
85- children : PropTypes . node . isRequired
86- } ;
87-
8837const isUserOwner = ( { project, user } ) => ( project . owner && project . owner . id === user . id ) ;
8938
9039const IDEViewMobile = ( props ) => {
9140 const {
92- preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning
41+ preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
42+ selectedFile, updateFileContent, files,
43+ closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges,
44+ startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
45+ showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch
9346 } = props ;
9447
95- const [ tmController , setTmController ] = useState ( null ) ;
48+ const [ tmController , setTmController ] = useState ( null ) ; // eslint-disable-line
49+ const [ overlay , setOverlay ] = useState ( null ) ; // eslint-disable-line
9650
9751 return (
9852 < Screen >
9953 < Header >
100- < IconLinkWrapper to = "/" aria-label = "Return to original editor" >
101- < ExitIcon />
102- </ IconLinkWrapper >
103- < div >
54+ < IconButton to = "/mobile" icon = { ExitIcon } aria-label = "Return to original editor" />
55+ < div style = { { marginLeft : '1rem' } } >
10456 < h2 > { project . name } </ h2 >
10557 < h3 > { selectedFile . name } </ h3 >
10658 </ div >
59+
60+ < IconContainer >
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+ </ IconContainer >
10768 </ Header >
10869
109- < Content >
70+ < IDEWrapper >
11071 < Editor
11172 lintWarning = { preferences . lintWarning }
11273 linewrap = { preferences . linewrap }
@@ -141,7 +102,7 @@ const IDEViewMobile = (props) => {
141102 runtimeErrorWarningVisible = { ide . runtimeErrorWarningVisible }
142103 provideController = { setTmController }
143104 />
144- </ Content >
105+ </ IDEWrapper >
145106 < Footer > < h2 > Bottom Bar</ h2 > </ Footer >
146107 </ Screen >
147108 ) ;
@@ -205,6 +166,8 @@ IDEViewMobile.propTypes = {
205166 updatedAt : PropTypes . string
206167 } ) . isRequired ,
207168
169+ startSketch : PropTypes . func . isRequired ,
170+
208171 updateLintMessage : PropTypes . func . isRequired ,
209172
210173 clearLintMessage : PropTypes . func . isRequired ,
0 commit comments