From 625ae3280bdf83b66a66873344acad4103d30006 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 13 Aug 2020 21:33:03 +0300 Subject: feat: create FileUpload component --- src/components/AttachLink/AttachLink.tsx | 6 ++--- src/components/FileUpload/FileUpload.tsx | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 src/components/FileUpload/FileUpload.tsx (limited to 'src/components') diff --git a/src/components/AttachLink/AttachLink.tsx b/src/components/AttachLink/AttachLink.tsx index b8742a2..eb7aebd 100644 --- a/src/components/AttachLink/AttachLink.tsx +++ b/src/components/AttachLink/AttachLink.tsx @@ -13,9 +13,9 @@ const AttachLink: React.FC = ({ callback, children }) => { const handleOpen = (): void => { setIsOpen(true); }; - + const defaultButton = ( - + ); + + return ( + <> + + {React.isValidElement(child) + ? React.cloneElement(child, { onClick }) + : defaultButton + } + + ); +}; + +export default FileUpload; -- cgit v1.2.3