diff options
author | ilyayudovin <46264063+ilyayudovin@users.noreply.github.com> | 2020-11-17 15:33:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 15:33:02 +0300 |
commit | db731f1b88fdfa95f16255767e44762211f47196 (patch) | |
tree | 84750528e47ae35e136bc8f24c1a575ccc81092f /src/containers/PollCreation | |
parent | cda51156c20c04a20a9fcfe1e0f3aa51f54e9ad2 (diff) | |
parent | 99b4e4aa53d3ade389fc270f9ba9b02904da93f6 (diff) | |
download | which-ui-db731f1b88fdfa95f16255767e44762211f47196.tar.gz |
Merge pull request #108 from which-ecosystem/avatarCrop
feat: Add avatar crop
Diffstat (limited to 'src/containers/PollCreation')
-rw-r--r-- | src/containers/PollCreation/PollCreation.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx index b761c73..46ab28d 100644 --- a/src/containers/PollCreation/PollCreation.tsx +++ b/src/containers/PollCreation/PollCreation.tsx @@ -1,4 +1,4 @@ -import React, { ChangeEvent, useState, useMemo } from 'react'; +import React, {ChangeEvent, useState, useMemo, useCallback} from 'react'; import Bluebird from 'bluebird'; import { makeStyles } from '@material-ui/core/styles'; import { Card, Container, LinearProgress, InputBase, Typography } from '@material-ui/core'; @@ -13,6 +13,7 @@ import UserStrip from '../../components/UserStrip/UserStrip'; import { post } from '../../requests'; import { useFeed, useProfile } from '../../hooks/APIClient'; import { useAuth } from '../../hooks/useAuth'; +import {useHistory} from "react-router"; const useStyles = makeStyles(theme => ({ images: { @@ -32,6 +33,7 @@ const useStyles = makeStyles(theme => ({ const PollCreation: React.FC = () => { const [description, setDescription] = useState<string>(''); const classes = useStyles(); + const history = useHistory(); const { enqueueSnackbar } = useSnackbar(); const { user } = useAuth(); const { mutate: updateFeed } = useFeed(); @@ -71,6 +73,9 @@ const PollCreation: React.FC = () => { } }; + const handleClose = useCallback(() => history.goBack(), [history]); + + const isSubmitting = useMemo(() => leftProgress + rightProgress > 0, [leftProgress, rightProgress]); return ( @@ -79,6 +84,7 @@ const PollCreation: React.FC = () => { actionIcon={<SendIcon />} handleAction={handleSubmit} isActionDisabled={!(left && right) || isSubmitting} + handleCloseModal={handleClose} > <Container maxWidth="sm" disableGutters> <Card elevation={3}> |