Skip to content

Commit e877735

Browse files
committed
refactor(web): remove MDX dependencies
1 parent 276454c commit e877735

17 files changed

Lines changed: 1074 additions & 2191 deletions

apps/web/package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
"@fortawesome/free-brands-svg-icons": "^6.7.2",
2323
"@fortawesome/react-fontawesome": "^0.2.2",
2424
"@hookform/resolvers": "^5.0.1",
25-
"@mdx-js/react": "^3.1.0",
26-
"@mdx-js/rollup": "^3.1.0",
2725
"@monaco-editor/react": "^4.7.0",
2826
"@radix-ui/react-alert-dialog": "^1.1.11",
2927
"@radix-ui/react-avatar": "^1.1.7",
@@ -41,15 +39,13 @@
4139
"@radix-ui/react-toggle": "^1.1.6",
4240
"@radix-ui/react-tooltip": "^1.2.4",
4341
"@tanstack/react-table": "^8.21.3",
44-
"@types/mdx": "^2.0.13",
4542
"@xyflow/react": "^12.6.0",
4643
"date-fns": "^4.1.0",
4744
"lucide-react": "^0.507.0",
4845
"react": "^19.1.0",
4946
"react-dom": "^19.1.0",
5047
"react-hook-form": "^7.56.3",
5148
"react-router": "^7.6.0",
52-
"remark-gfm": "^4.0.1",
5349
"sonner": "^2.0.3",
5450
"swr": "^2.3.3",
5551
"zod": "^3.24.4"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { cn } from "@/utils/utils";
2+
3+
interface CalloutProps {
4+
children: React.ReactNode;
5+
type?: "note" | "warning" | "tip" | "danger";
6+
}
7+
8+
export function Callout({ children, type = "note" }: CalloutProps) {
9+
const variants = {
10+
note: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100",
11+
warning:
12+
"border-yellow-200 bg-yellow-50 text-yellow-900 dark:border-yellow-800 dark:bg-yellow-950 dark:text-yellow-100",
13+
tip: "border-green-200 bg-green-50 text-green-900 dark:border-green-800 dark:bg-green-950 dark:text-green-100",
14+
danger:
15+
"border-red-200 bg-red-50 text-red-900 dark:border-red-800 dark:bg-red-950 dark:text-red-100",
16+
};
17+
18+
return (
19+
<div className={cn("border-l-4 p-4 my-6 rounded-r-lg", variants[type])}>
20+
{children}
21+
</div>
22+
);
23+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import { Check, Copy } from "lucide-react";
2+
import { useState } from "react";
3+
4+
import { Button } from "@/components/ui/button";
5+
import { cn } from "@/utils/utils";
6+
7+
interface CodeBlockProps {
8+
children: React.ReactNode;
9+
className?: string;
10+
language?: string;
11+
}
12+
13+
export function CodeBlock({ children, className, language }: CodeBlockProps) {
14+
const [copied, setCopied] = useState(false);
15+
const isInline = !className && !language;
16+
17+
if (isInline) {
18+
return (
19+
<code className="relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold">
20+
{children}
21+
</code>
22+
);
23+
}
24+
25+
const handleCopy = async () => {
26+
try {
27+
await navigator.clipboard.writeText(String(children));
28+
setCopied(true);
29+
setTimeout(() => setCopied(false), 2000);
30+
} catch (err) {
31+
console.error("Failed to copy text: ", err);
32+
}
33+
};
34+
35+
return (
36+
<div className="relative group">
37+
<pre className="mb-4 mt-6 overflow-x-auto rounded-lg border bg-zinc-950 text-white p-4">
38+
<Button
39+
size="icon"
40+
variant="ghost"
41+
className="absolute right-2 top-2 opacity-0 group-hover:opacity-100 transition-opacity h-8 w-8 text-zinc-400 hover:text-zinc-100 hover:bg-transparent"
42+
onClick={handleCopy}
43+
>
44+
{copied ? (
45+
<Check className="h-4 w-4" />
46+
) : (
47+
<Copy className="h-4 w-4" />
48+
)}
49+
</Button>
50+
<code
51+
className={cn(
52+
"text-sm",
53+
className,
54+
language && `language-${language}`
55+
)}
56+
>
57+
{children}
58+
</code>
59+
</pre>
60+
</div>
61+
);
62+
}

apps/web/src/components/layouts/docs-layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
import React, { useEffect } from "react";
1010
import { Link, useLocation } from "react-router";
1111

12-
import { MdxProvider } from "@/components/mdx-provider";
1312
import { Badge } from "@/components/ui/badge";
1413
import { Button } from "@/components/ui/button";
1514
import { ScrollArea } from "@/components/ui/scroll-area";
@@ -266,8 +265,8 @@ export function DocsLayout({
266265
</div>
267266

268267
{/* Content */}
269-
<div className="prose prose-slate dark:prose-invert max-w-none">
270-
<MdxProvider>{children}</MdxProvider>
268+
<div className="prose prose-slate dark:prose-invert max-w-none docs-content">
269+
{children}
271270
</div>
272271

273272
{/* Navigation */}

0 commit comments

Comments
 (0)