All files / src/components/views/Credentials/CredentialShare ShareViaSocial.tsx

0% Statements 0/7
100% Branches 0/0
0% Functions 0/1
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                                                             
import { Flex, Link } from "rimble-ui";
import { VC } from "vc-schema-tools";
import { TwitterBird, LinkedIn, Facebook } from "../../../elements/Icons";
import { useVcSchema } from "../../../../services/useVcSchema";
import { CopyToClipboard } from "../../../elements/CopyToClipboard/CopyToClipboard";
 
export const ShareViaSocial: React.FC<{ vc: VC; vcUrl: string }> = (props) => {
  const { vc, vcUrl } = props;
  const { vcSchemaName } = useVcSchema(vc);
  const shareText = `Check out my ${vcSchemaName} credential 👉 ${vcUrl}
 
#SertoID`;
  const shareTextParam = encodeURIComponent(shareText);
  const vcUrlParam = encodeURIComponent(vcUrl);
 
  return (
    <Flex>
      <Link mr={5} mt={1} href={"https://twitter.com/intent/tweet?text=" + shareTextParam} target="_blank">
        <TwitterBird size={32} />
      </Link>
      <Link mr={5} href={"https://www.linkedin.com/sharing/share-offsite/?url=" + vcUrlParam} target="_blank">
        <LinkedIn size={32} />
      </Link>
      <Link mr={5} href={"https://www.facebook.com/sharer.php?u=" + vcUrlParam} target="_blank">
        <Facebook size={32} />
      </Link>
      <CopyToClipboard hoverTitle="Copy share text" size="32px" text={shareText} />
    </Flex>
  );
};