From 348852cfa4275f5c642669b43697f83c35333044 Mon Sep 17 00:00:00 2001 From: pierrbt Date: Fri, 23 Jun 2023 20:07:49 +0200 Subject: [PATCH] feat: Adding the possibility of copying the link by clicking text and icons (#171) --- .../modals/showCompletedReverseShareModal.tsx | 25 ++-------- .../src/components/upload/CopyTextField.tsx | 48 +++++++++++++++++++ .../modals/showCompletedUploadModal.tsx | 26 ++-------- 3 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 frontend/src/components/upload/CopyTextField.tsx diff --git a/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx b/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx index 54a872ac..10068a85 100644 --- a/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx +++ b/frontend/src/components/share/modals/showCompletedReverseShareModal.tsx @@ -1,9 +1,7 @@ -import { ActionIcon, Button, Stack, TextInput } from "@mantine/core"; -import { useClipboard } from "@mantine/hooks"; +import { Button, Stack } from "@mantine/core"; import { useModals } from "@mantine/modals"; import { ModalsContextProps } from "@mantine/modals/lib/context"; -import { TbCopy } from "react-icons/tb"; -import toast from "../../../utils/toast.util"; +import CopyTextField from "../../upload/CopyTextField"; const showCompletedReverseShareModal = ( modals: ModalsContextProps, @@ -26,28 +24,11 @@ const Body = ({ link: string; getReverseShares: () => void; }) => { - const clipboard = useClipboard({ timeout: 500 }); const modals = useModals(); return ( - { - clipboard.copy(link); - toast.success("Your link was copied to the keyboard."); - }} - > - - - ) - } - /> +