import { BASE_URL } from "core/httpClient"; import { useRef, useState } from "react"; import { useTranslation } from "react-i18next"; import { Button } from "../../../Button/Button"; import { SVGCopy, SVGShare, SVGXmark } from "../../../icons"; import Typography from "../../../typography/Typography"; import { CopyToClipboard } from "react-copy-to-clipboard"; import { Popover } from "@headlessui/react"; type Props = { emphasis?: "high" | "low"; linktoCopy?: string; }; export function ShareButton({ emphasis, linktoCopy }: Props) { const [t, i18next] = useTranslation("translation", { keyPrefix: "articlePage.interactionButtons", }); const [copied, setCopied] = useState(false); const copyValue = BASE_URL != undefined && linktoCopy != undefined ? BASE_URL + linktoCopy : t("searchResults.nothingFound"); function onCopy() { setCopied(true); setTimeout(() => { setCopied(false); }, 1500); }; const handleFocus = (event: any) => event.target.select(); return (
{copied && (
{t("copied")}
)}
); }