MCPcopy Create free account
hub / github.com/arctic-cli/interface / Code

Function Code

packages/ui/src/components/code.tsx:13–48  ·  view source on GitHub ↗
(props: CodeProps<T>)

Source from the content-addressed store, hash-verified

11}
12
13export function Code<T>(props: CodeProps<T>) {
14 let container!: HTMLDivElement
15 const [local, others] = splitProps(props, ["file", "class", "classList", "annotations"])
16
17 const file = createMemo(
18 () =>
19 new File<T>(
20 {
21 ...createDefaultOptions<T>("unified"),
22 ...others,
23 },
24 workerPool,
25 ),
26 )
27
28 createEffect(() => {
29 container.innerHTML = ""
30 file().render({
31 file: local.file,
32 lineAnnotations: local.annotations,
33 containerWrapper: container,
34 })
35 })
36
37 return (
38 <div
39 data-component="code"
40 style={styleVariables}
41 classList={{
42 ...(local.classList || {}),
43 [local.class ?? ""]: !!local.class,
44 }}
45 ref={container}
46 />
47 )
48}

Callers

nothing calls this directly

Calls 2

createDefaultOptionsFunction · 0.90
fileFunction · 0.85

Tested by

no test coverage detected