import { useCallback } from "react";
import { useTranslation } from "react-i18next";
import { blip } from "../utils";

const useClipboard = () => {
  const { t } = useTranslation();
  const copy = useCallback(
    url => () => {
      navigator.clipboard.writeText(url);
      blip.info(t("Generic.CopiedToClipboard"));
    },
    [t]
  );
  return { copy };
};

export { useClipboard };
