UNPKG

@mantine/code-highlight

Version:

Code highlight with Mantine theme

29 lines (25 loc) 871 B
'use client'; 'use strict'; var jsxRuntime = require('react/jsx-runtime'); var hooks = require('@mantine/hooks'); var CodeHighlightControl = require('../CodeHighlightControl/CodeHighlightControl.cjs'); var CopyIcon = require('./CopyIcon.cjs'); function CopyCodeButton({ code, copyLabel = "Copy", copiedLabel = "Copied" }) { const clipboard = hooks.useClipboard(); return /* @__PURE__ */ jsxRuntime.jsx( CodeHighlightControl.CodeHighlightControl, { onClick: () => clipboard.copy(code.trim()), variant: "none", tooltipLabel: clipboard.copied ? copiedLabel : copyLabel, children: /* @__PURE__ */ jsxRuntime.jsx(CopyIcon.CopyIcon, { copied: clipboard.copied }) } ); } CopyCodeButton.displayName = "@mantine/code-highlight/CopyCodeButton"; exports.CopyCodeButton = CopyCodeButton; //# sourceMappingURL=CopyCodeButton.cjs.map