All files / src/components/common/Drawers CopyCodeDrawer.tsx

0% Statements 0/11
0% Branches 0/2
0% Functions 0/1
0% Lines 0/11

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33                                                                 
import hljs from "highlight.js/lib/core";
import yaml from "highlight.js/lib/languages/yaml";
import curl from "highlight.js/lib/languages/bash";
import CustomDrawer from "../CustomDrawer/index.tsx";
import CopyCode from "../CopyCode/index.js";
import { DrawerTypes } from "../../../store/features/drawers/drawerTypes.ts";
 
hljs.registerLanguage("yaml", yaml);
hljs.registerLanguage("curl", curl);
 
const id = DrawerTypes.COPY_CODE;
 
function CopyCodeDrawer({ content, language, title, subtitle, help }) {
  return (
    <CustomDrawer id={id}>
      <div className="p-2">
        <div>
          <h1 className="font-bold text-xl">{title}</h1>
          <p className="mt-2">{subtitle}</p>
        </div>
        <CopyCode content={content} language={language} />
        {help && (
          <div className="mt-4 rounded border p-2 border-violet-500 bg-violet-50">
            {help}
          </div>
        )}
      </div>
    </CustomDrawer>
  );
}
 
export default CopyCodeDrawer;