@mantine/code-highlight
Version:
Code highlight with Mantine theme
33 lines (32 loc) • 1.27 kB
JavaScript
"use client";
import { useCodeHighlightContext } from "../CodeHighlight.context.mjs";
import { ActionIcon, Tooltip, polymorphicFactory, useProps } from "@mantine/core";
import { jsx } from "react/jsx-runtime";
//#region packages/@mantine/code-highlight/src/CodeHighlight/CodeHighlightControl/CodeHighlightControl.tsx
const CodeHighlightControl = polymorphicFactory((_props) => {
const { children, vars, tooltipLabel, ...others } = useProps("CodeHighlightControl", null, _props);
const ctx = useCodeHighlightContext();
const tooltipStyles = ctx.getStyles("controlTooltip");
const control = /* @__PURE__ */ jsx(ActionIcon, {
...ctx.getStyles("control"),
...others,
variant: "none",
"data-code-color-scheme": ctx.codeColorScheme,
children
});
if (tooltipLabel) return /* @__PURE__ */ jsx(Tooltip, {
label: tooltipLabel,
fz: "sm",
position: "bottom",
classNames: { tooltip: tooltipStyles.className },
styles: { tooltip: tooltipStyles.style },
"data-code-color-scheme": ctx.codeColorScheme,
transitionProps: { duration: 0 },
children: control
});
return control;
});
CodeHighlightControl.displayName = "@mantine/code-highlight/CodeHighlightControl";
//#endregion
export { CodeHighlightControl };
//# sourceMappingURL=CodeHighlightControl.mjs.map