Skip to content

Commit 02b095b

Browse files
authored
Merge pull request #131 from code0-tech/feat/#128
Add Auto Type Table
2 parents fb944d3 + 2594084 commit 02b095b

3 files changed

Lines changed: 146 additions & 17 deletions

File tree

app/[...slug]/page.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import {source} from '@/lib/source';
2-
import {
3-
DocsPage,
4-
DocsBody,
5-
DocsDescription,
6-
DocsTitle,
7-
} from 'fumadocs-ui/page';
2+
import {DocsBody, DocsDescription, DocsPage, DocsTitle,} from 'fumadocs-ui/page';
83
import {notFound} from 'next/navigation';
94
import {createRelativeLink} from 'fumadocs-ui/mdx';
105
import {getMDXComponents} from '@/mdx-components';
11-
import type {LoaderConfig, LoaderOutput, Page} from 'fumadocs-core/source';
6+
import { AutoTypeTable, type AutoTypeTableProps } from 'fumadocs-typescript/ui';
127
import type {ComponentProps, FC} from 'react';
8+
import {createGenerator} from "fumadocs-typescript";
139

1410
export default async function Page(props: {
1511
params: Promise<{ slug?: string[] }>;
@@ -30,6 +26,9 @@ export default async function Page(props: {
3026
<DocsBody>
3127
<MDXContent
3228
components={getMDXComponents({
29+
AutoTypeTable: (props: Partial<AutoTypeTableProps>) => (
30+
<AutoTypeTable {...props} generator={createGenerator()}/>
31+
),
3332
// this allows you to link to other pages with relative file paths
3433
a: createRelativeLinkWithFilenameOnly(source, page),
3534
})}
@@ -65,9 +64,9 @@ function createRelativeLinkWithFilenameOnly(
6564
): FC<ComponentProps<'a'>> {
6665
const RelativeLinkBase = createRelativeLink(sourceInst, page);
6766

68-
return function RelativeLink({ href, ...props }) {
67+
return function RelativeLink({href, ...props}) {
6968
if (!href || href.startsWith('http')) {
70-
return <RelativeLinkBase {...props} href={href} />;
69+
return <RelativeLinkBase {...props} href={href}/>;
7170
}
7271

7372
let finalHref = href;
@@ -78,6 +77,6 @@ function createRelativeLinkWithFilenameOnly(
7877
finalHref = `./${path}${hash ? `#${hash.toLowerCase()}` : ''}`;
7978
}
8079

81-
return <RelativeLinkBase {...props} href={finalHref} />;
80+
return <RelativeLinkBase {...props} href={finalHref}/>;
8281
};
8382
}

package-lock.json

Lines changed: 136 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"fumadocs-core": "^16.7.7",
1414
"fumadocs-mdx": "^14.2.11",
1515
"fumadocs-ui": "^16.7.7",
16+
"fumadocs-typescript": "^5.2.0",
1617
"next": "16.1.7",
1718
"react": "^19.1.0",
1819
"react-dom": "^19.1.0"

0 commit comments

Comments
 (0)