forked from hirosystems/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mdx-components.tsx
52 lines (50 loc) · 1.47 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
41
42
43
44
45
46
47
48
49
50
51
52
import type { MDXComponents } from "mdx/types";
import { Accordion, Accordions } from "fumadocs-ui/components/accordion";
import { Callout } from "@/components/callout";
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import { TypeTable } from "fumadocs-ui/components/type-table";
import defaultComponents from "fumadocs-ui/mdx";
import {
CodeBlock,
type CodeBlockProps,
Pre,
} from "fumadocs-ui/components/codeblock";
import type { ReactNode } from "react";
import { Popup, PopupContent, PopupTrigger } from "fumadocs-ui/twoslash/popup";
import { cn } from "./utils/cn";
const shortcuts: Record<string, string> = {
stacks: "./content/docs/stacks/props.ts",
ordinals: "./content/docs/bitcoin/props.ts",
};
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...defaultComponents,
Popup,
PopupContent,
PopupTrigger,
pre: ({ title, className, icon, allowCopy, ...props }: CodeBlockProps) => (
<CodeBlock title={title} icon={icon} allowCopy={allowCopy}>
<Pre className={cn("max-h-[400px]", className)} {...props} />
</CodeBlock>
),
Tabs,
Tab,
Callout,
TypeTable,
Accordion,
Accordions,
InstallTabs: ({
items,
children,
}: {
items: string[];
children: ReactNode;
}) => (
<Tabs items={items} id="package-manager">
{children}
</Tabs>
),
blockquote: (props) => <Callout>{props.children}</Callout>,
...components,
};
}