Skip to content

Commit 26336a2

Browse files
committed
🚧 change mobile breakpoint to 800px
1 parent ddc95fa commit 26336a2

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

client/routes.jsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,12 @@ const checkAuth = (store) => {
2727
store.dispatch(getUser());
2828
};
2929

30-
// const MobileFirstRoute = props => (
31-
// <Route path={props.path} {...props}>
32-
// <MediaQuery minDeviceWidth={1224}>
33-
// {matches => (matches
34-
// ? props.component(props)
35-
// : props.fallback(props))}
36-
// </MediaQuery>
37-
// </Route>);
38-
39-
// MobileFirstRoute.propTypes = {
40-
// path: PropTypes.string.isRequired,
41-
// component: PropTypes.any.isRequired, // eslint-disable-line
42-
// fallback: PropTypes.any.isRequired // eslint-disable-line
43-
// };
30+
const mobileFirst = (MobileComponent, Fallback) => props => (
31+
<MediaQuery minDeviceWidth={800}>
32+
{matches => (matches
33+
? <Fallback {...props} />
34+
: <MobileComponent {...props} />)}
35+
</MediaQuery>);
4436

4537
// TODO: This short-circuit seems unnecessary - using the mobile <Switch /> navigator (future) should prevent this from being called
4638
const onRouteChange = (store) => {
@@ -52,15 +44,7 @@ const onRouteChange = (store) => {
5244

5345
const routes = store => (
5446
<Route path="/" component={App} onChange={() => { onRouteChange(store); }}>
55-
<IndexRoute
56-
onEnter={checkAuth(store)}
57-
component={props => (
58-
<MediaQuery minDeviceWidth={1224}>
59-
{matches => (matches
60-
? <IDEView {...props} />
61-
: <MobileIDEView {...props} />)}
62-
</MediaQuery>)}
63-
/>
47+
<IndexRoute onEnter={checkAuth(store)} component={mobileFirst(MobileIDEView, IDEView)} />
6448

6549
<Route path="/login" component={userIsNotAuthenticated(LoginView)} />
6650
<Route path="/signup" component={userIsNotAuthenticated(SignupView)} />

0 commit comments

Comments
 (0)