11import React from 'react' ;
22import { Badge } from '@/components/ui/badge' ;
3-
4- // ---------------------------------------------------------------------------
5- // Code block with syntax highlighting via <pre><code>
6- // ---------------------------------------------------------------------------
3+ import MermaidChart from './MermaidChart' ;
74function MdxCode ( {
85 children,
96 className,
@@ -14,7 +11,7 @@ function MdxCode({
1411 if ( ! isBlock ) {
1512 return (
1613 < code
17- className = 'rounded bg-[#1a1a1a] px-1.5 py-0.5 font-mono text-sm text-[#a7f950] '
14+ className = 'bg-muted text-primary rounded px-1.5 py-0.5 font-mono text-sm'
1815 { ...props }
1916 >
2017 { children }
@@ -31,7 +28,7 @@ function MdxCode({
3128function MdxPre ( { children, ...props } : React . ComponentProps < 'pre' > ) {
3229 return (
3330 < pre
34- className = 'my-6 overflow-x-auto rounded-lg border border-[#2b2b2b] bg-[#111827] p-4 text-sm leading-relaxed'
31+ className = 'bg-background-card my-6 overflow-x-auto rounded-lg border border-gray-900 p-4 text-sm leading-relaxed'
3532 { ...props }
3633 >
3734 { children }
@@ -44,9 +41,9 @@ function MdxPre({ children, ...props }: React.ComponentProps<'pre'>) {
4441// ---------------------------------------------------------------------------
4542function MdxTable ( { children, ...props } : React . ComponentProps < 'table' > ) {
4643 return (
47- < div className = 'my-6 w-full overflow-x-auto rounded-lg border border-[#2b2b2b] ' >
44+ < div className = 'my-6 w-full overflow-x-auto rounded-lg border border-gray-900 ' >
4845 < table
49- className = 'w-full border-collapse text-sm text-[#d1d5db] '
46+ className = 'text-muted-foreground w-full border-collapse text-sm'
5047 { ...props }
5148 >
5249 { children }
@@ -57,7 +54,7 @@ function MdxTable({ children, ...props }: React.ComponentProps<'table'>) {
5754
5855function MdxThead ( { children, ...props } : React . ComponentProps < 'thead' > ) {
5956 return (
60- < thead className = 'bg-[#1a1a1a] text-[#ffffff] ' { ...props } >
57+ < thead className = 'bg-section text-foreground ' { ...props } >
6158 { children }
6259 </ thead >
6360 ) ;
@@ -66,7 +63,7 @@ function MdxThead({ children, ...props }: React.ComponentProps<'thead'>) {
6663function MdxTh ( { children, ...props } : React . ComponentProps < 'th' > ) {
6764 return (
6865 < th
69- className = 'border-b border-[#2b2b2b] px-4 py-3 text-left font-semibold'
66+ className = 'border-b border-gray-900 px-4 py-3 text-left font-semibold'
7067 { ...props }
7168 >
7269 { children }
@@ -76,37 +73,27 @@ function MdxTh({ children, ...props }: React.ComponentProps<'th'>) {
7673
7774function MdxTd ( { children, ...props } : React . ComponentProps < 'td' > ) {
7875 return (
79- < td className = 'border-b border-[#2b2b2b] px-4 py-3' { ...props } >
76+ < td className = 'border-b border-gray-900 px-4 py-3' { ...props } >
8077 { children }
8178 </ td >
8279 ) ;
8380}
8481
8582function MdxTr ( { children, ...props } : React . ComponentProps < 'tr' > ) {
8683 return (
87- < tr className = 'transition-colors hover:bg-[#1a1a1a] /50' { ...props } >
84+ < tr className = 'hover:bg-section /50 transition-colors ' { ...props } >
8885 { children }
8986 </ tr >
9087 ) ;
9188}
9289
90+ function MdxTbody ( { children, ...props } : React . ComponentProps < 'tbody' > ) {
91+ return < tbody { ...props } > { children } </ tbody > ;
92+ }
93+
9394// ---------------------------------------------------------------------------
94- // Mermaid diagram — renders the raw text inside a styled container.
95- // Full client-side rendering would require a 'use client' wrapper + mermaid.js;
96- // for now we render a readable fallback with the diagram source.
95+ // Mermaid diagram — client component that renders with mermaid.js
9796// ---------------------------------------------------------------------------
98- function Mermaid ( { children } : { children ?: React . ReactNode } ) {
99- return (
100- < div className = 'my-6 rounded-lg border border-[#2b2b2b] bg-[#111827] p-4' >
101- < p className = 'mb-2 text-xs font-semibold tracking-wider text-[#6b7280] uppercase' >
102- Diagram
103- </ p >
104- < pre className = 'font-mono text-sm whitespace-pre-wrap text-[#d1d5db]' >
105- { children }
106- </ pre >
107- </ div >
108- ) ;
109- }
11097
11198// ---------------------------------------------------------------------------
11299// Exported component map — passed to compileMDX
@@ -117,10 +104,11 @@ export const mdxComponents = {
117104 code : MdxCode ,
118105 table : MdxTable ,
119106 thead : MdxThead ,
107+ tbody : MdxTbody ,
120108 th : MdxTh ,
121109 td : MdxTd ,
122110 tr : MdxTr ,
123111 // Named components usable inside .mdx files as <Badge> / <Mermaid>
124112 Badge,
125- Mermaid,
113+ Mermaid : MermaidChart ,
126114} ;
0 commit comments