From 388ccd1ae73e0dcc710e9b497e95c70a131c73cc Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Fri, 9 Oct 2020 00:21:58 +0300
Subject: feat: remove gap between header on mobile

---
 src/containers/PollCreation/PollCreation.tsx | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'src/containers/PollCreation/PollCreation.tsx')

diff --git a/src/containers/PollCreation/PollCreation.tsx b/src/containers/PollCreation/PollCreation.tsx
index 33d95bb..2e2bd06 100644
--- a/src/containers/PollCreation/PollCreation.tsx
+++ b/src/containers/PollCreation/PollCreation.tsx
@@ -1,4 +1,4 @@
-import React, { ChangeEvent, useState } from 'react';
+import React, { ChangeEvent, useState, useMemo } from 'react';
 import Bluebird from 'bluebird';
 import { makeStyles } from '@material-ui/core/styles';
 import { Card, Container, LinearProgress, InputBase, Typography } from '@material-ui/core';
@@ -72,12 +72,14 @@ const PollCreation: React.FC = () => {
     }
   };
 
+  const isSubmitting = useMemo(() => leftProgress + rightProgress > 0, [leftProgress, rightProgress]);
+
   return (
     <ModalScreen
       title="Create a poll"
       actionIcon={<SendIcon />}
       handleAction={handleSubmit}
-      isActionDisabled={!(left && right) || leftProgress + rightProgress > 0}
+      isActionDisabled={!(left && right) || isSubmitting}
     >
       <Container maxWidth="sm" disableGutters>
         <Card elevation={3}>
@@ -89,6 +91,7 @@ const PollCreation: React.FC = () => {
               placeholder="Add description"
               onChange={handleDescriptionChange}
               className={classes.description}
+              readOnly={isSubmitting}
             />
           </Typography>
           <div className={classes.images}>
@@ -96,7 +99,7 @@ const PollCreation: React.FC = () => {
             <ImageInput callback={setRight} progress={rightProgress} />
           </div>
         </Card>
-        {(leftProgress + rightProgress > 0) && (
+        {isSubmitting && (
           <>
             <LinearProgress color="primary" />
             <Message
-- 
cgit v1.2.3

