From 4109cd1b2fca7e4934f0aba1c3a7fabab62270bb Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 13 Aug 2020 20:50:31 +0300 Subject: feat: create AttachLink component --- src/components/UploadImage/UploadImage.tsx | 76 ------------------------------ 1 file changed, 76 deletions(-) delete mode 100644 src/components/UploadImage/UploadImage.tsx (limited to 'src/components/UploadImage/UploadImage.tsx') diff --git a/src/components/UploadImage/UploadImage.tsx b/src/components/UploadImage/UploadImage.tsx deleted file mode 100644 index 238d5cd..0000000 --- a/src/components/UploadImage/UploadImage.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import React, { useState } from 'react'; -import { - Button, - TextField, - Dialog, - DialogActions, - DialogContent, - DialogContentText, - DialogTitle -} from '@material-ui/core'; - -interface PropTypes { - isOpen: boolean; - setIsOpen: (value: boolean) => void; - callback: (url: string) => void; -} - -const UploadImage: React.FC = ({ setIsOpen, isOpen, callback }) => { - const [url, setUrl] = useState(''); - - const handleClose = () => { - setIsOpen(false); - }; - - const handleSubmit = () => { - let result = url; - if (url.startsWith('https://www.instagram.com/')) { - const match = url.match('/p/(.*)/'); - const id = match && match[1]; - result = `https://www.instagram.com/p/${id}/media/?size=l`; - } else if (url.startsWith('https://drive.google.com/')) { - const match = url.match('/d/(.*)/'); - const fileId = match && match[1]; - result = `https://drive.google.com/uc?export=view&id=${fileId}`; - } - callback(result || ''); - handleClose(); - }; - - const handleChange = (event:React.ChangeEvent) => { - setUrl(event.target.value); - }; - - return ( -
- - Upload an Image - - - Unfortunetly we do not support uploading images yet. Please provide a valid URL to your image: - - - - - - - - -
- ); -}; - -export default UploadImage; -- cgit v1.2.3