, "">;
export function ArticleInteractionButtons({
isAbstractOpen = false,
children,
- openAbstract = () => { },
+ openAbstract = () => {},
className,
articleID,
emphasis = "high", //to change displaying of component
...props
}: ArticleButtonProps) {
+ const [t, i18next] = useTranslation("translation", {
+ keyPrefix: "articlePage.interactionButtons",
+ });
+ /* ----------------------------- Abstract Button ---------------------------- */
const abstractButton = (
);
+
+ /* ---------------------------- Read file button ---------------------------- */
+ const readFileButton = (
+
+
+
+ {emphasis === "high" && {t("readFile")}}
+
+
+ );
+ /* ----------------------------- Download button ---------------------------- */
+ const downLoadButton = (
+
+ );
+
+ /* ------------------------------ Share button ------------------------------ */
+
+ const shareButton = (
+
+ );
+
const fileInteractionButtons = interactionButtonsStore.map((button) => {
- return (
- button.title === 'Read file' ?
-
-
-
- :
+ return button.title === "Read file" ? (
+
+
+ ) : (
+
);
});
return (
{emphasis === "low" && !children ? abstractButton : null}
+ {readFileButton}
{children ? children : fileInteractionButtons}
+
);
}
diff --git a/src/components/Article/ArticleParts/InteractionButtons/ArticleShareButton.tsx b/src/components/Article/ArticleParts/InteractionButtons/ArticleShareButton.tsx
new file mode 100644
index 0000000..fca7da8
--- /dev/null
+++ b/src/components/Article/ArticleParts/InteractionButtons/ArticleShareButton.tsx
@@ -0,0 +1,87 @@
+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")}
+
+ )}
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/components/ArticleSearchResult.tsx b/src/components/ArticleSearchResult.tsx
index c569005..a1571be 100644
--- a/src/components/ArticleSearchResult.tsx
+++ b/src/components/ArticleSearchResult.tsx
@@ -47,10 +47,11 @@ export const ArticleSearchResult = ({ searchItem }: Props) => {
{searchItem.tags}
);
- return {link}
;
+ return link;
}
diff --git a/src/core/httpClient.ts b/src/core/httpClient.ts
index 3b4d76b..83f7924 100755
--- a/src/core/httpClient.ts
+++ b/src/core/httpClient.ts
@@ -1,5 +1,5 @@
import axios from "axios";
-const BASE_URL = process.env.REACT_APP_INTEGRATOR_URL;
+export const BASE_URL = process.env.REACT_APP_INTEGRATOR_URL;
export const GRAPHQL_URL = process.env.REACT_APP_GRAPHQL_URL ?? "";
const instance = axios.create({