Skip to content

Commit

Permalink
client: Use fullscreen dialogs on mobile.
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Mar 16, 2017
1 parent ef8eacc commit 73b7f29
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion client/components/DescriptionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ import stripIndent from 'strip-indent';
import Markdown from 'react-markdown';
import Button from 'material-ui/Button';
import Dialog, { DialogTitle, DialogContent, DialogActions } from 'material-ui/Dialog';
import getContext from 'recompose/getContext';

const enhance = getContext({
isMobile: React.PropTypes.bool,
});

const DescriptionDialog = ({
server,
isMobile,
isOpen,
onCloseDescription,
}) => (
<Dialog
open={isOpen}
fullScreen={isMobile}
onRequestClose={onCloseDescription}
>
<DialogTitle>
Expand Down Expand Up @@ -41,4 +48,4 @@ const DescriptionDialog = ({
</Dialog>
);

export default DescriptionDialog;
export default enhance(DescriptionDialog);
10 changes: 9 additions & 1 deletion client/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
import React from 'react';
import Head from 'next/head';
import ThemeProvider from 'material-ui/styles/MuiThemeProvider';
import withContext from 'recompose/withContext';
import isMobile from 'is-mobile';

import createUwaveTheme from '../muiTheme';
import AppBar from './AppBar';
import Text from './Text';
import SSR from './SSR';

const enhance = withContext({
isMobile: React.PropTypes.bool,
}, ({ userAgent }) => ({
isMobile: isMobile(userAgent),
}));

const Layout = ({
children,
userAgent,
Expand Down Expand Up @@ -74,4 +82,4 @@ const Layout = ({
</ThemeProvider>
);

export default Layout;
export default enhance(Layout);
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"description": "Web client for üWave's server listing.",
"dependencies": {
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
"is-mobile": "^0.2.2",
"isomorphic-fetch": "^2.2.1",
"material-ui": "^1.0.0-alpha.3",
"ms": "^0.7.2",
Expand Down

0 comments on commit 73b7f29

Please sign in to comment.