-
Notifications
You must be signed in to change notification settings - Fork 57
/
mdx-components.tsx
40 lines (39 loc) · 1.26 KB
/
mdx-components.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import type { MDXComponents } from "mdx/types";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
import { Callout } from "@/components/callout";
import { Cards, Card, SecondaryCard } from "@/components/card";
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import { TypeTable } from "fumadocs-ui/components/type-table";
import defaultComponents from "fumadocs-ui/mdx";
import { docskit } from "@/components/docskit/components";
import { CustomTable as Table, TableProps } from "@/components/table";
import { OrderedList, UnorderedList } from "@/components/lists";
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...defaultComponents,
Accordion,
Accordions,
blockquote: (props) => <Callout>{props.children}</Callout>,
Callout,
Cards,
Card,
SecondaryCard,
code: (props) => (
<code
{...props}
className="border border-border p-1 bg-code text-sm text-muted-foreground"
/>
),
hr: (props) => (
<hr {...props} className="border-t border-border/50 mt-0 mb-6" />
),
Tab,
Tabs,
table: (props: TableProps) => <Table {...props} />,
TypeTable,
ol: OrderedList,
ul: UnorderedList,
...components,
...docskit,
};
}