Skip to content

Commit 611cc24

Browse files
committed
fix(website): use static CodeBlock component in type table
1 parent fb9159c commit 611cc24

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { highlight } from "fumadocs-core/highlight";
2+
import * as Base from "fumadocs-ui/components/codeblock";
3+
4+
export interface CodeBlockProps {
5+
code: string;
6+
lang: string;
7+
wrapper?: Base.CodeBlockProps;
8+
}
9+
10+
export async function CodeBlock({ code, lang, wrapper }: CodeBlockProps) {
11+
const rendered = await highlight(code, {
12+
components: {
13+
pre: Base.Pre,
14+
},
15+
lang,
16+
themes: {
17+
dark: "vesper",
18+
light: "github-light",
19+
},
20+
});
21+
22+
return <Base.CodeBlock {...wrapper}>{rendered}</Base.CodeBlock>;
23+
}

apps/website/content/docs/configurations.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/* eslint-disable perfectionist/sort-objects */
22
import dedent from "dedent";
3-
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
43
import { TypeTable } from "fumadocs-ui/components/type-table";
54
import { Link } from "next-view-transitions";
65

6+
import { CodeBlock } from "#/components/code-block";
7+
78
export function SettingsTypeTable() {
89
return (
910
<TypeTable
@@ -39,7 +40,7 @@ export function SettingsTypeTable() {
3940
description: <Link href="#additionalcomponents">An array of components and its attributes mapping ⤵</Link>,
4041
default: "[]",
4142
typeDescription: (
42-
<DynamicCodeBlock
43+
<CodeBlock
4344
code={dedent`
4445
type CustomComponent = {
4546
name: string;
@@ -60,7 +61,7 @@ export function SettingsTypeTable() {
6061
description: <Link href="#additionalhooks">An object of aliases for React built-in Hooks ⤵</Link>,
6162
default: "{}",
6263
typeDescription: (
63-
<DynamicCodeBlock
64+
<CodeBlock
6465
code={dedent`
6566
type ReactBuiltInHookName =
6667
| "use"

0 commit comments

Comments
 (0)