diff options
author | ilyayudovin <ilyayudovin123@gmail.com> | 2020-10-29 21:28:52 +0300 |
---|---|---|
committer | ilyayudovin <ilyayudovin123@gmail.com> | 2020-10-29 21:28:52 +0300 |
commit | 5eba5c1ffcdaee9a81e965f0570b00dd26bb38c6 (patch) | |
tree | d003cb63ce9915f45142a529c865aaf6cd3a98c3 /src/components/AvatarCrop | |
parent | a40961a2564738ca9f14d9e50e0d1d5c6ab7ec54 (diff) | |
download | which-ui-5eba5c1ffcdaee9a81e965f0570b00dd26bb38c6.tar.gz |
Wait till modal slide right on close
Diffstat (limited to 'src/components/AvatarCrop')
-rw-r--r-- | src/components/AvatarCrop/AvatarCrop.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/AvatarCrop/AvatarCrop.tsx b/src/components/AvatarCrop/AvatarCrop.tsx index e344edd..ef6d9c8 100644 --- a/src/components/AvatarCrop/AvatarCrop.tsx +++ b/src/components/AvatarCrop/AvatarCrop.tsx @@ -6,8 +6,8 @@ import ModalScreen from "../ModalScreen/ModalScreen"; import { getCroppedImg } from './canvasUtils'
interface PropTypes {
- location?: any;
avatarToCrop: string;
+ setAvatarToCrop: (src: string) => void;
callback: (file: File) => void;
}
@@ -23,7 +23,7 @@ const useStyles = makeStyles(theme => ({ }
}));
-const AvatarCrop: React.FC<PropTypes> = ({location, avatarToCrop, callback}) => {
+const AvatarCrop: React.FC<PropTypes> = ({ avatarToCrop, setAvatarToCrop, callback }) => {
const classes = useStyles();
const [crop, setCrop] = useState({x: 0, y: 0});
const [zoom, setZoom] = useState(1);
@@ -42,12 +42,17 @@ const AvatarCrop: React.FC<PropTypes> = ({location, avatarToCrop, callback}) => }
}, [avatarToCrop, croppedAreaPixels]);
+ const handleCloseModal = useCallback( () => {
+ setAvatarToCrop('');
+ },[]);
+
return (
<ModalScreen
title="Choose area"
actionIcon={<SendIcon />}
handleAction={handleLoadCroppedImage}
isActionDisabled={false}
+ handleCloseModal={handleCloseModal}
>
<div className={classes.cropContainer}>
<Cropper
|