Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
Make Modal component mobile-friendly (#118)
Browse files Browse the repository at this point in the history
Modal (MUI Dialogue behind the scenes) is now full screen on small mobile
devices.

Refs #100.
  • Loading branch information
nina-py authored Feb 4, 2021
1 parent 8b1d734 commit 58c289d
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { makeStyles, Theme, createStyles } from '@material-ui/core/styles';
import {
Box,
CircularProgress,
Dialog,
DialogProps,
Typography,
useMediaQuery,
useTheme,
} from '@material-ui/core';

interface ModalProps {
Expand All @@ -16,19 +17,6 @@ interface ModalProps {
content: string;
}

/**
* Styles for the Modal component.
*/
const useStyles = makeStyles((theme: Theme) =>
createStyles({
paper: {
width: 350,
height: 70,
boxShadow: theme.shadows[5],
},
})
);

/**
* A simple "Loading..." modal with a progress icon and a text message.
*
Expand All @@ -38,18 +26,18 @@ export const Modal: React.FC<DialogProps & ModalProps> = ({
content,
open,
}): JSX.Element => {
const classes = useStyles();
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));

return (
<Dialog open={open} onBackdropClick={() => true}>
<Dialog open={open} onBackdropClick={() => true} fullScreen={fullScreen}>
<Box
className={classes.paper}
flex="1"
display="flex"
justifyContent="center"
alignItems="center"
py={2}
px={4}
py={3}
px={9}
>
<CircularProgress />
<Box p={2}>
Expand Down

0 comments on commit 58c289d

Please sign in to comment.