File tree 2 files changed +27
-3
lines changed
2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 1
1
/* eslint-disable perfectionist/sort-objects */
2
2
import dedent from "dedent" ;
3
- import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock" ;
4
3
import { TypeTable } from "fumadocs-ui/components/type-table" ;
5
4
import { Link } from "next-view-transitions" ;
6
5
6
+ import { CodeBlock } from "#/components/code-block" ;
7
+
7
8
export function SettingsTypeTable ( ) {
8
9
return (
9
10
< TypeTable
@@ -39,7 +40,7 @@ export function SettingsTypeTable() {
39
40
description : < Link href = "#additionalcomponents" > An array of components and its attributes mapping ⤵</ Link > ,
40
41
default : "[]" ,
41
42
typeDescription : (
42
- < DynamicCodeBlock
43
+ < CodeBlock
43
44
code = { dedent `
44
45
type CustomComponent = {
45
46
name: string;
@@ -60,7 +61,7 @@ export function SettingsTypeTable() {
60
61
description : < Link href = "#additionalhooks" > An object of aliases for React built-in Hooks ⤵</ Link > ,
61
62
default : "{}" ,
62
63
typeDescription : (
63
- < DynamicCodeBlock
64
+ < CodeBlock
64
65
code = { dedent `
65
66
type ReactBuiltInHookName =
66
67
| "use"
You can’t perform that action at this time.
0 commit comments