diff --git a/src/components/File.tsx b/src/components/File.tsx index c160896..c3b4f2c 100644 --- a/src/components/File.tsx +++ b/src/components/File.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, {useMemo} from 'react'; import { List, Button, @@ -8,16 +8,18 @@ import { SyncOutlined, IssuesCloseOutlined, LockOutlined, + DownloadOutlined, + ShareAltOutlined, } from '@ant-design/icons'; import { FileType } from '../contexts/Encryption'; -import { CheckCircle, XCircle, Download, Trash, Loader } from 'react-feather'; interface Props { remove: () => void; file: FileType; } -const downloadLink = (name: string, url: string) => { +const downloadLink = (name: string, blob: Blob) => { + const url = URL.createObjectURL(blob); const downloadLink = document.createElement('a'); downloadLink.href = url; downloadLink.download = name; @@ -32,6 +34,17 @@ const icons: {[name: string]: any} = { encrypted: , }; +const share = async (file: FileType, fileData: File[]) => { + try { + navigator.share({ + title: file.name, + files: fileData, + } as any); + } catch (err) { + alert(err); + } +} + const IconText = ({ icon, text, ...props }) => (