MCPcopy Index your code
hub / github.com/fontsource/fontsource / CodeWrapper

Function CodeWrapper

website/app/components/code/Code.tsx:66–98  ·  view source on GitHub ↗
({ children, language, code }: CodeWrapperProps)

Source from the content-addressed store, hash-verified

64}
65
66export const CodeWrapper = ({ children, language, code }: CodeWrapperProps) => {
67 const clipboard = useClipboard({ timeout: 1500 });
68 const copyLabel = clipboard.copied ? 'Copied' : 'Copy code';
69
70 return (
71 <figure className={classes.root} translate="no">
72 <Text component="span" className={classes.dots} aria-hidden="true">
73 &#11044;&#11044;
74 </Text>
75 {children}
76 <Group gap={0} className={classes.tools} component="figcaption">
77 {language ? (
78 <div className={classes.language}>
79 <Text component="span" fw={400} fz={13}>
80 {displayLanguage(language)}
81 </Text>
82 </div>
83 ) : null}
84 <Tooltip label={copyLabel} withArrow arrowSize={6} offset={6}>
85 <ActionIcon
86 className={classes.copy}
87 aria-label={copyLabel}
88 onClick={() => {
89 clipboard.copy(code);
90 }}
91 >
92 <IconCopy aria-hidden="true" stroke="white" />
93 </ActionIcon>
94 </Tooltip>
95 </Group>
96 </figure>
97 );
98};
99
100interface CodeHighlightProps {
101 code: string;

Callers

nothing calls this directly

Calls 1

displayLanguageFunction · 0.90

Tested by

no test coverage detected