import { faCopy } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { JSX, useLayoutEffect, useState } from "react"; import { type BundledLanguage, highlight } from "../../highlight"; type Props = { code: string; language: BundledLanguage; }; function Plaintext({ code }: { code: string }) { const lines = code.split("\n"); return (
{lines.map((line, i) => (
{line}
{i < lines.length - 1 ? "\n" : ""}
))}
);
}
export default function CodeBlock({ code, language }: Props) {
const [nodes, setNodes] = useState