From 6e31f5d88ee33d2557a109f7d30b0deebc3691d8 Mon Sep 17 00:00:00 2001 From: pheralb Date: Fri, 24 Jun 2022 13:32:18 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=92=EF=B8=8F=20Create=20svg=20info=20page?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/svgInfo.tsx | 87 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/components/svgInfo.tsx diff --git a/src/components/svgInfo.tsx b/src/components/svgInfo.tsx new file mode 100644 index 0000000..ee22990 --- /dev/null +++ b/src/components/svgInfo.tsx @@ -0,0 +1,87 @@ +import React from "react"; +import { + Button, + Flex, + Heading, + HStack, + Icon, + Image, + Link, +} from "@chakra-ui/react"; +import { ArrowSquareOut, Copy, DownloadSimple } from "phosphor-react"; +import confetti from "canvas-confetti"; +import download from "downloadjs"; +import { toast } from "react-hot-toast"; +import { ToastTheme } from "@/theme/toast"; +import { SVGCardProps } from "@/interfaces/components"; + +// Download SVG => +const downloadSvg = (url?: string) => { + confetti({ + particleCount: 200, + startVelocity: 30, + spread: 300, + gravity: 1.2, + origin: { y: 0 }, + }); + download(url || ""); +}; + +// Copy to clipboard => +const copyToClipboard = (url?: string) => { + fetch(url || "").then((response) => { + response.text().then((content) => { + navigator.clipboard.writeText(content); + toast("Copied to clipboard", ToastTheme); + }); + }); +}; + +const SVGInfo = (props: SVGCardProps) => { + return ( + + {props.title} + + {props.title} + + + + + + {props.title} website + + + + ); +}; + +export default SVGInfo;