UNPKG

@mantine/code-highlight

Version:

Code highlight with Mantine theme

21 lines (20 loc) 1.08 kB
"use client"; const require_CodeHighlightControl = require("../CodeHighlightControl/CodeHighlightControl.cjs"); const require_CopyIcon = require("./CopyIcon.cjs"); let _mantine_hooks = require("@mantine/hooks"); let react_jsx_runtime = require("react/jsx-runtime"); //#region packages/@mantine/code-highlight/src/CodeHighlight/CopyCodeButton/CopyCodeButton.tsx function CopyCodeButton({ code, copyLabel = "Copy", copiedLabel = "Copied" }) { const clipboard = (0, _mantine_hooks.useClipboard)(); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CodeHighlightControl.CodeHighlightControl, { onClick: () => clipboard.copy(code.trim()), variant: "none", tooltipLabel: clipboard.copied ? copiedLabel : copyLabel, "aria-label": clipboard.copied ? copiedLabel : `${copyLabel} code`, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CopyIcon.CopyIcon, { copied: clipboard.copied }) }); } CopyCodeButton.displayName = "@mantine/code-highlight/CopyCodeButton"; //#endregion exports.CopyCodeButton = CopyCodeButton; //# sourceMappingURL=CopyCodeButton.cjs.map