diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/AttachLink/AttachLink.tsx | 2 | ||||
-rw-r--r-- | src/components/Message/Message.tsx | 9 | ||||
-rw-r--r-- | src/components/ModalScreen/ModalScreen.tsx | 20 |
3 files changed, 22 insertions, 9 deletions
diff --git a/src/components/AttachLink/AttachLink.tsx b/src/components/AttachLink/AttachLink.tsx index 742ba65..7c32635 100644 --- a/src/components/AttachLink/AttachLink.tsx +++ b/src/components/AttachLink/AttachLink.tsx @@ -21,7 +21,7 @@ const AttachLink: React.FC<PropTypes> = ({ callback, children }) => { color="primary" startIcon={<LinkIcon />} > - Attach a link + Link </Button> ); diff --git a/src/components/Message/Message.tsx b/src/components/Message/Message.tsx index f568552..e5191ed 100644 --- a/src/components/Message/Message.tsx +++ b/src/components/Message/Message.tsx @@ -6,6 +6,7 @@ import { makeStyles } from '@material-ui/core/styles'; interface PropTypes { tagline?: string; message?: string; + noMargin?: boolean; } const useStyles = makeStyles(theme => ({ @@ -13,7 +14,9 @@ const useStyles = makeStyles(theme => ({ display: 'flex', flexDirection: 'column', justifyContent: 'center', - alignItems: 'center', + alignItems: 'center' + }, + margin: { marginTop: theme.spacing(6) }, content: { @@ -21,11 +24,11 @@ const useStyles = makeStyles(theme => ({ } })); -const Message: React.FC<PropTypes> = React.memo(({ tagline, message, children }) => { +const Message: React.FC<PropTypes> = React.memo(({ tagline, message, noMargin, children }) => { const classes = useStyles(); return ( - <div className={classes.root}> + <div className={`${classes.root} ${!noMargin && classes.margin}`}> <div className={classes.content}> {children} </div> diff --git a/src/components/ModalScreen/ModalScreen.tsx b/src/components/ModalScreen/ModalScreen.tsx index 81e5c5a..c6f0565 100644 --- a/src/components/ModalScreen/ModalScreen.tsx +++ b/src/components/ModalScreen/ModalScreen.tsx @@ -12,11 +12,14 @@ import { useTheme } from '@material-ui/core'; import { makeStyles } from '@material-ui/core/styles'; -import CloseIcon from '@material-ui/icons/Close'; import { TransitionProps } from '@material-ui/core/transitions'; +import CloseIcon from '@material-ui/icons/Close'; interface PropTypes { title: string; + actionIcon?: JSX.Element; + handleAction?: () => void; + isActionDisabled?: boolean; } const useStyles = makeStyles(theme => ({ @@ -24,7 +27,7 @@ const useStyles = makeStyles(theme => ({ backgroundColor: theme.palette.background.default }, content: { - padding: theme.spacing(3, 0, 0, 0) + padding: theme.spacing(6, 0) }, toolbar: { display: 'flex', @@ -37,7 +40,7 @@ const Transition = React.forwardRef(( ref: React.Ref<unknown> ) => <Slide direction="left" ref={ref} {...props} />); -const ModalScreen: React.FC<PropTypes> = ({ title, children }) => { +const ModalScreen: React.FC<PropTypes> = ({ title, actionIcon, handleAction, isActionDisabled, children }) => { const [isOpen, setIsOpen] = useState<boolean>(true); const classes = useStyles(); const theme = useTheme(); @@ -47,13 +50,20 @@ const ModalScreen: React.FC<PropTypes> = ({ title, children }) => { const handleClose = useCallback(() => setIsOpen(false), [setIsOpen]); const onExited = useCallback(() => history.goBack(), [history]); + const handleClickAction = useCallback(async () => { + if (handleAction) await handleAction(); + return handleClose(); + }, [handleAction, handleClose]); + return ( <Dialog open={isOpen} + onClose={handleClose} onExited={onExited} TransitionComponent={Transition} PaperProps={{ className: classes.root }} fullScreen={isMobile} + maxWidth="md" fullWidth > <AppBar position="static"> @@ -64,8 +74,8 @@ const ModalScreen: React.FC<PropTypes> = ({ title, children }) => { <Typography variant="h6"> { title } </Typography> - <IconButton style={{ opacity: 0, pointerEvents: 'none' }}> - <CloseIcon /> + <IconButton onClick={handleClickAction} disabled={isActionDisabled}> + { actionIcon } </IconButton> </Toolbar> </AppBar> |