Adeen commited on
Commit ·
e305dc7
1
Parent(s): 1974805
style: increase width of notes area to max-w-6xl
Browse files
src/components/MarkdownView.tsx
CHANGED
|
@@ -5,10 +5,85 @@ import rehypeKatex from "rehype-katex";
|
|
| 5 |
|
| 6 |
export default function MarkdownView({ children }: { children: string }) {
|
| 7 |
return (
|
| 8 |
-
<div className="
|
| 9 |
<ReactMarkdown
|
| 10 |
remarkPlugins={[remarkGfm, remarkMath]}
|
| 11 |
rehypePlugins={[rehypeKatex]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
>
|
| 13 |
{children}
|
| 14 |
</ReactMarkdown>
|
|
|
|
| 5 |
|
| 6 |
export default function MarkdownView({ children }: { children: string }) {
|
| 7 |
return (
|
| 8 |
+
<div className="max-w-6xl mx-auto py-8 px-4 sm:px-12 bg-slate-900/30 rounded-2xl border border-slate-800/50 backdrop-blur-sm shadow-2xl">
|
| 9 |
<ReactMarkdown
|
| 10 |
remarkPlugins={[remarkGfm, remarkMath]}
|
| 11 |
rehypePlugins={[rehypeKatex]}
|
| 12 |
+
components={{
|
| 13 |
+
h1: ({ children }) => (
|
| 14 |
+
<div className="text-center mb-12 mt-4">
|
| 15 |
+
<h1 className="text-4xl sm:text-5xl font-bold tracking-tight text-white inline-block relative pb-4">
|
| 16 |
+
{children}
|
| 17 |
+
<span className="absolute bottom-0 left-1/4 right-1/4 h-1 bg-primary rounded-full opacity-60" />
|
| 18 |
+
</h1>
|
| 19 |
+
</div>
|
| 20 |
+
),
|
| 21 |
+
h2: ({ children }) => (
|
| 22 |
+
<h2 className="text-2xl sm:text-3xl font-bold mt-12 mb-6 text-white flex items-center gap-3 group">
|
| 23 |
+
<span className="w-1.5 h-8 bg-primary rounded-full group-hover:scale-y-110 transition-transform" />
|
| 24 |
+
{children}
|
| 25 |
+
</h2>
|
| 26 |
+
),
|
| 27 |
+
h3: ({ children }) => (
|
| 28 |
+
<h3 className="text-xl font-semibold mt-8 mb-4 text-slate-100 flex items-center gap-2">
|
| 29 |
+
<span className="w-1 h-1 rounded-full bg-primary/60" />
|
| 30 |
+
{children}
|
| 31 |
+
</h3>
|
| 32 |
+
),
|
| 33 |
+
p: ({ children }) => (
|
| 34 |
+
<p className="text-slate-300 leading-relaxed mb-6 text-lg font-light">
|
| 35 |
+
{children}
|
| 36 |
+
</p>
|
| 37 |
+
),
|
| 38 |
+
blockquote: ({ children }) => (
|
| 39 |
+
<div className="my-8 p-6 bg-primary/5 border-l-4 border-primary rounded-r-xl backdrop-blur-md">
|
| 40 |
+
<div className="text-primary-foreground/90 italic text-lg leading-relaxed font-medium">
|
| 41 |
+
{children}
|
| 42 |
+
</div>
|
| 43 |
+
</div>
|
| 44 |
+
),
|
| 45 |
+
ul: ({ children }) => (
|
| 46 |
+
<ul className="space-y-3 mb-8 ml-4">
|
| 47 |
+
{children}
|
| 48 |
+
</ul>
|
| 49 |
+
),
|
| 50 |
+
li: ({ children }) => (
|
| 51 |
+
<li className="flex items-start gap-3 text-slate-300 text-lg">
|
| 52 |
+
<span className="mt-2.5 w-1.5 h-1.5 rounded-full bg-primary/40 shrink-0" />
|
| 53 |
+
<span>{children}</span>
|
| 54 |
+
</li>
|
| 55 |
+
),
|
| 56 |
+
table: ({ children }) => (
|
| 57 |
+
<div className="my-10 overflow-hidden rounded-xl border border-slate-800 shadow-xl bg-slate-900/50">
|
| 58 |
+
<table className="w-full border-collapse text-left">
|
| 59 |
+
{children}
|
| 60 |
+
</table>
|
| 61 |
+
</div>
|
| 62 |
+
),
|
| 63 |
+
thead: ({ children }) => (
|
| 64 |
+
<thead className="bg-slate-800/80 text-slate-200">
|
| 65 |
+
{children}
|
| 66 |
+
</thead>
|
| 67 |
+
),
|
| 68 |
+
th: ({ children }) => (
|
| 69 |
+
<th className="px-6 py-4 font-bold uppercase tracking-wider text-xs border-b border-slate-700">
|
| 70 |
+
{children}
|
| 71 |
+
</th>
|
| 72 |
+
),
|
| 73 |
+
td: ({ children }) => (
|
| 74 |
+
<td className="px-6 py-4 border-b border-slate-800 text-slate-300 text-sm">
|
| 75 |
+
{children}
|
| 76 |
+
</td>
|
| 77 |
+
),
|
| 78 |
+
strong: ({ children }) => (
|
| 79 |
+
<strong className="font-bold text-primary/90 underline decoration-primary/30 underline-offset-4">
|
| 80 |
+
{children}
|
| 81 |
+
</strong>
|
| 82 |
+
),
|
| 83 |
+
hr: () => (
|
| 84 |
+
<hr className="my-12 border-t border-slate-800/80" />
|
| 85 |
+
),
|
| 86 |
+
}}
|
| 87 |
>
|
| 88 |
{children}
|
| 89 |
</ReactMarkdown>
|