File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 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 11/* eslint-disable perfectionist/sort-objects */
22import dedent from "dedent" ;
3- import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock" ;
43import { TypeTable } from "fumadocs-ui/components/type-table" ;
54import { Link } from "next-view-transitions" ;
65
6+ import { CodeBlock } from "#/components/code-block" ;
7+
78export 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"
You can’t perform that action at this time.
0 commit comments