feat: Adding the possibility of copying the link by clicking text and icons (#171)

This commit is contained in:
pierrbt
2023-06-23 20:07:49 +02:00
committed by GitHub
parent 932496a121
commit 348852cfa4
3 changed files with 55 additions and 44 deletions

View File

@@ -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 (
<Stack align="stretch">
<TextInput
readOnly
variant="filled"
value={link}
rightSection={
window.isSecureContext && (
<ActionIcon
onClick={() => {
clipboard.copy(link);
toast.success("Your link was copied to the keyboard.");
}}
>
<TbCopy />
</ActionIcon>
)
}
/>
<CopyTextField link={link} />
<Button
onClick={() => {