MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / Syntax

Function Syntax

apps/start/src/components/syntax.tsx:24–62  ·  view source on GitHub ↗
({
  code,
  className,
  language = 'typescript',
  wrapLines = false,
  copyable = true,
}: SyntaxProps)

Source from the content-addressed store, hash-verified

22}
23
24export default function Syntax({
25 code,
26 className,
27 language = 'typescript',
28 wrapLines = false,
29 copyable = true,
30}: SyntaxProps) {
31 return (
32 <div className={cn('group relative rounded-lg', className)}>
33 {copyable && (
34 <button
35 className="row absolute top-1 right-1 items-center gap-2 rounded bg-card p-2 opacity-0 transition-opacity group-hover:opacity-100"
36 onClick={() => {
37 clipboard(code, null);
38 }}
39 type="button"
40 >
41 <span>Copy</span>
42 <CopyIcon size={12} />
43 </button>
44 )}
45 <SyntaxHighlighter
46 customStyle={{
47 borderRadius: 'var(--radius)',
48 padding: '1rem',
49 paddingTop: '0.5rem',
50 paddingBottom: '0.5rem',
51 fontSize: 14,
52 lineHeight: 1.3,
53 }}
54 language={language}
55 style={docco}
56 wrapLongLines={wrapLines}
57 >
58 {code}
59 </SyntaxHighlighter>
60 </div>
61 );
62}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
clipboardFunction · 0.90

Tested by

no test coverage detected