From 88d3c411efbf5f6ac74fa67e38c154f1e53d4938 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Fri, 14 Aug 2020 02:24:18 +0300 Subject: feat: show upload progress --- src/containers/PollCreation/PollCreationImage.tsx | 34 +++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) (limited to 'src/containers/PollCreation/PollCreationImage.tsx') diff --git a/src/containers/PollCreation/PollCreationImage.tsx b/src/containers/PollCreation/PollCreationImage.tsx index 1200b11..d619a8e 100644 --- a/src/containers/PollCreation/PollCreationImage.tsx +++ b/src/containers/PollCreation/PollCreationImage.tsx @@ -3,15 +3,17 @@ import { makeStyles } from '@material-ui/core/styles'; import { CardActionArea, CardMedia, - Typography + Typography, + CircularProgress } from '@material-ui/core'; -import ClearIcon from '@material-ui/icons/CancelOutlined'; +import { Check, CancelOutlined } from '@material-ui/icons'; import AttachLink from '../../components/AttachLink/AttachLink'; import FileUpload from '../../components/FileUpload/FileUpload'; interface PropTypes { callback: (file?: File | string) => void; + progress?: number; } const useStyles = makeStyles({ @@ -32,11 +34,25 @@ const useStyles = makeStyles({ display: 'flex', justifyContent: 'center', alignItems: 'center' + }, + darkOverlay: { + backgroundColor: 'rgba(0, 0, 0, 0.45)', + color: 'white', + position: 'absolute', + top: 0, + left: 0, + transitionDuration: '0.5s' + }, + invisible: { + backgroundColor: 'rgba(0, 0, 0, 0)', + }, + icon: { + color: 'white' } }); -const PollCreationImage: React.FC = ({ callback }) => { +const PollCreationImage: React.FC = ({ callback, progress }) => { const classes = useStyles(); const [url, setUrl] = useState(); @@ -59,9 +75,17 @@ const PollCreationImage: React.FC = ({ callback }) => { ); const Media = ( - + - +
+ { + progress + ? progress < 100 + ? + : + : + } +
); -- cgit v1.2.3