diff --git a/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx b/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx deleted file mode 100644 index f53877e..0000000 --- a/src/www/src/app/(pages)/docs/_components/code-line-with-flag.tsx +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; -import { useToast } from "@/components/ui/use-toast"; -import { useLang } from "@/providers/lang-provider"; -import { Check, Files, X } from "lucide-react"; -import { useState } from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { vscDarkPlus } from "react-syntax-highlighter/dist/esm/styles/prism"; -interface ICodeLineWithFlag { - code: string; - language: string; - className?: string; - showLangFlag?: boolean; -} - -const CodeLineWithFlag = ({ - code, - language, - className, - showLangFlag = true, -}: ICodeLineWithFlag) => { - const { lang } = useLang(); - const [isCopying, setIsCopying] = useState({ - isCopying: false, - Icon: Files, - }); - - const { toast } = useToast(); - - const codeWithLangFlag = `${code} -${lang}`; - - const handleCopy = () => { - setIsCopying((prev) => ({ ...prev, isCopying: true })); - try { - navigator.clipboard.writeText(showLangFlag ? codeWithLangFlag : code); - setIsCopying((prev) => ({ ...prev, Icon: Check })); - toast({ - description: "Code copied to clipboard 🚀", - }); - } catch (err) { - setIsCopying((prev) => ({ ...prev, Icon: X })); - toast({ - description: "Failed to copy code 😢", - variant: "destructive", - }); - } finally { - setTimeout(() => { - setIsCopying(() => ({ isCopying: false, Icon: Files })); - }, 2000); - } - }; - - return ( -