fix unused components still loading on posts

This commit is contained in:
2022-01-06 09:10:25 -05:00
parent b29a2b8756
commit 6b756a54c1
9 changed files with 131 additions and 129 deletions
+6 -3
View File
@@ -1,15 +1,18 @@
import { useState, useEffect } from "react";
import copy from "copy-to-clipboard";
import innerText from "react-innertext";
import { CopyOcticon, CheckOcticon } from "../icons/octicons";
import styles from "./CopyButton.module.scss";
import type { ReactNode } from "react";
type Props = {
content: string;
source: ReactNode;
timeout?: number;
};
const CopyButton = ({ content, timeout = 2000 }: Props) => {
const CopyButton = ({ source, timeout = 2000 }: Props) => {
const [copied, setCopied] = useState(false);
const handleCopy = (e) => {
@@ -19,7 +22,7 @@ const CopyButton = ({ content, timeout = 2000 }: Props) => {
e.target.blur();
// send plaintext to the clipboard
const didCopy = copy(content);
const didCopy = copy(innerText(source));
// indicate success
setCopied(didCopy);