From 4109cd1b2fca7e4934f0aba1c3a7fabab62270bb Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
Date: Thu, 13 Aug 2020 20:50:31 +0300
Subject: feat: create AttachLink component

---
 src/containers/PollCreation/PollCreationImage.tsx | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

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

diff --git a/src/containers/PollCreation/PollCreationImage.tsx b/src/containers/PollCreation/PollCreationImage.tsx
index f19162d..e2084bb 100644
--- a/src/containers/PollCreation/PollCreationImage.tsx
+++ b/src/containers/PollCreation/PollCreationImage.tsx
@@ -8,7 +8,7 @@ import {
   Button
 } from '@material-ui/core';
 import { CloudUpload, CancelOutlined, Link, Publish } from '@material-ui/icons/';
-import UploadImage from '../../components/UploadImage/UploadImage';
+import AttachLink from '../../components/AttachLink/AttachLink';
 
 interface PropTypes {
   file?: File | string;
@@ -45,7 +45,6 @@ const PollCreationImage: React.FC<PropTypes> = ({ file, setFile }) => {
   const { files, onClick, HiddenFileInput } = useFilePicker();
   const [url, setUrl] = useState<string>();
   const [isMediaHover, setIsMediaHover] = useState<boolean>(false);
-  const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
 
   const handleMouseEnter = (): void => {
     setIsMediaHover(true);
@@ -63,10 +62,6 @@ const PollCreationImage: React.FC<PropTypes> = ({ file, setFile }) => {
     }
   }, [files, setFile]);
 
-  const handleOpenModal = () => {
-    setIsModalOpen(true);
-  };
-
   const callback = (result: string) => {
     setUrl(result);
     setFile(result);
@@ -85,15 +80,7 @@ const PollCreationImage: React.FC<PropTypes> = ({ file, setFile }) => {
         Upload
       </Button>
       <Typography variant="h6"> or </Typography>
-      <Button 
-        onClick={handleOpenModal}
-        variant="outlined"
-        color="primary"
-        startIcon={<Link />}
-      >
-        Attach a link
-      </Button>
-      <UploadImage callback={callback} isOpen={isModalOpen} setIsOpen={setIsModalOpen} />
+      <AttachLink callback={callback} />
     </>
   );
 
-- 
cgit v1.2.3

