aboutsummaryrefslogtreecommitdiff
path: root/src/components/ModalScreen/ModalScreen.tsx
diff options
context:
space:
mode:
authorilyayudovin <46264063+ilyayudovin@users.noreply.github.com>2020-11-17 15:33:02 +0300
committerGitHub <noreply@github.com>2020-11-17 15:33:02 +0300
commitdb731f1b88fdfa95f16255767e44762211f47196 (patch)
tree84750528e47ae35e136bc8f24c1a575ccc81092f /src/components/ModalScreen/ModalScreen.tsx
parentcda51156c20c04a20a9fcfe1e0f3aa51f54e9ad2 (diff)
parent99b4e4aa53d3ade389fc270f9ba9b02904da93f6 (diff)
downloadwhich-ui-db731f1b88fdfa95f16255767e44762211f47196.tar.gz
Merge pull request #108 from which-ecosystem/avatarCrop
feat: Add avatar crop
Diffstat (limited to 'src/components/ModalScreen/ModalScreen.tsx')
-rw-r--r--src/components/ModalScreen/ModalScreen.tsx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/components/ModalScreen/ModalScreen.tsx b/src/components/ModalScreen/ModalScreen.tsx
index cf76272..b71c2c8 100644
--- a/src/components/ModalScreen/ModalScreen.tsx
+++ b/src/components/ModalScreen/ModalScreen.tsx
@@ -1,5 +1,4 @@
import React, { useState, useCallback } from 'react';
-import { useHistory } from 'react-router-dom';
import {
AppBar,
Dialog,
@@ -20,6 +19,7 @@ interface PropTypes {
actionIcon?: JSX.Element;
handleAction?: () => void;
isActionDisabled?: boolean;
+ handleCloseModal?: ()=> void;
}
const useStyles = makeStyles(theme => ({
@@ -42,15 +42,14 @@ const Transition = React.forwardRef((
ref: React.Ref<unknown>
) => <Slide direction="left" ref={ref} {...props} />);
-const ModalScreen: React.FC<PropTypes> = ({ title, actionIcon, handleAction, isActionDisabled, children }) => {
+const ModalScreen: React.FC<PropTypes> = ({ title, actionIcon, handleAction, isActionDisabled, handleCloseModal, children }) => {
const [isOpen, setIsOpen] = useState<boolean>(true);
const classes = useStyles();
const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
- const history = useHistory();
const handleClose = useCallback(() => setIsOpen(false), [setIsOpen]);
- const onExited = useCallback(() => history.goBack(), [history]);
+ const onExited = useCallback(() => handleCloseModal && handleCloseModal(), [handleCloseModal]);
const handleClickAction = useCallback(async () => {
if (handleAction) await handleAction();