Skip to content

Commit cb2f42d

Browse files
committed
⛏ switch to mobile screen by window width
1 parent 3502844 commit cb2f42d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import React from 'react';
2+
3+
export default () => (<div>
4+
<h1>Test</h1>
5+
</div>); //eslint-disable-line

client/routes.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Route, IndexRoute } from 'react-router';
22
import React from 'react';
33
import App from './modules/App/App';
44
import IDEView from './modules/IDE/pages/IDEView';
5+
import IDEViewMobile from './modules/IDE/pages/IDEViewMobile';
56
import FullView from './modules/IDE/pages/FullView';
67
import LoginView from './modules/User/pages/LoginView';
78
import SignupView from './modules/User/pages/SignupView';
@@ -24,9 +25,11 @@ const onRouteChange = (store) => {
2425
store.dispatch(stopSketch());
2526
};
2627

28+
const isMobile = () => window.innerWidth <= 760;
29+
2730
const routes = store => (
2831
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
29-
<IndexRoute component={IDEView} onEnter={checkAuth(store)} />
32+
<IndexRoute component={isMobile() ? IDEViewMobile : IDEView} onEnter={checkAuth(store)} />
3033
<Route path="/login" component={userIsNotAuthenticated(LoginView)} />
3134
<Route path="/signup" component={userIsNotAuthenticated(SignupView)} />
3235
<Route path="/reset-password" component={userIsNotAuthenticated(ResetPasswordView)} />
@@ -49,6 +52,7 @@ const routes = store => (
4952
<Route path="/:username/collections/create" component={DashboardView} />
5053
<Route path="/:username/collections/:collection_id" component={CollectionView} />
5154
<Route path="/about" component={IDEView} />
55+
5256
</Route>
5357
);
5458

0 commit comments

Comments
 (0)