diff --git a/components/tinaMarkdownComponents/docAndBlogComponents.tsx b/components/tinaMarkdownComponents/docAndBlogComponents.tsx index b653e55df..305852258 100644 --- a/components/tinaMarkdownComponents/docAndBlogComponents.tsx +++ b/components/tinaMarkdownComponents/docAndBlogComponents.tsx @@ -1,9 +1,10 @@ +import { CheckIcon, ClipboardIcon } from '@heroicons/react/24/outline'; import { CardGrid } from 'components/blocks/CardGrid'; import RecipeBlock from 'components/blocks/Recipe'; import { GraphQLQueryResponseTabs } from 'components/ui/GraphQLQueryResponseTabs'; import dynamic from 'next/dynamic'; import Image from 'next/image'; -import { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { BiRightArrowAlt } from 'react-icons/bi'; import { FaMinus, FaPlus } from 'react-icons/fa'; import { FiLink } from 'react-icons/fi'; @@ -11,8 +12,6 @@ import { Components, TinaMarkdown } from 'tinacms/dist/rich-text'; import { getDocId } from 'utils/docs/getDocIds'; import { WarningCallout } from 'utils/shortcodes'; import { Prism } from '../styles/Prism'; -import React from 'react'; -import { CheckIcon, ClipboardIcon } from '@heroicons/react/24/outline'; const ScrollBasedShowcase = dynamic( () => import('./templateComponents/scrollBasedShowcase'), { @@ -316,31 +315,35 @@ export const docAndBlogComponents: Components<{ // @ts-ignore TODO: fix this in TinaCMS code_block: ({ value, lang, children }) => { const [hasCopied, setHasCopied] = React.useState(false); - + const handleCopy = () => { - navigator.clipboard.writeText(children || value || ""); + navigator.clipboard.writeText(children || value || ''); setHasCopied(true); setTimeout(() => setHasCopied(false), 2000); }; - + return (