11import { ArrowLeft } from "lucide-react" ;
2- import ReactMarkdown , { type Components } from "react-markdown " ;
2+ import type { ReactNode } from "react" ;
33import { AppLink } from "@/components/app-link" ;
44import { Badge } from "@/components/ui/badge" ;
55import { Button } from "@/components/ui/button" ;
@@ -13,12 +13,12 @@ export interface BlogPostData {
1313 publishedAt : string | Date ;
1414 tags : string [ ] ;
1515 readingMinutes : number ;
16- content : string ;
1716}
1817
1918interface Props {
2019 post : BlogPostData ;
2120 className ?: string ;
21+ children ?: ReactNode ;
2222}
2323
2424function formatDate ( iso : string | Date ) {
@@ -31,70 +31,7 @@ function formatDate(iso: string | Date) {
3131 } ) . format ( date ) ;
3232}
3333
34- const markdownComponents : Components = {
35- h2 : ( { children } ) => (
36- < h2 className = "text-2xl md:text-3xl font-display font-bold tracking-tight mt-10 mb-4 text-balance" >
37- { children }
38- </ h2 >
39- ) ,
40- p : ( { children } ) => (
41- < p className = "text-foreground/90 text-lg leading-relaxed mb-6" >
42- { children }
43- </ p >
44- ) ,
45- blockquote : ( { children } ) => (
46- < blockquote className = "pl-6 border-l-2 border-primary my-8 italic text-lg text-foreground/80" >
47- { children }
48- </ blockquote >
49- ) ,
50- ul : ( { children } ) => (
51- < ul className = "space-y-2 pl-5 list-disc text-foreground/90 text-lg leading-relaxed mb-6 marker:text-primary/50" >
52- { children }
53- </ ul >
54- ) ,
55- ol : ( { children } ) => (
56- < ol className = "space-y-2 pl-5 list-decimal text-foreground/90 text-lg leading-relaxed mb-6 marker:text-primary/50" >
57- { children }
58- </ ol >
59- ) ,
60- code : ( { className, children, ...props } ) => {
61- const match = / l a n g u a g e - ( \w + ) / . exec ( className || "" ) ;
62- const isBlock = ! ! match || ( children as string ) ?. includes ?.( "\n" ) ;
63-
64- if ( ! isBlock && ! match ) {
65- return (
66- < code
67- className = "bg-secondary px-1.5 py-0.5 rounded-md font-mono text-sm"
68- { ...props }
69- >
70- { children }
71- </ code >
72- ) ;
73- }
74-
75- return (
76- < div className = "code-panel rounded-xl overflow-hidden my-8" >
77- < div className = "code-panel__header px-4 py-3 flex items-center justify-between select-none" >
78- < div className = "flex items-center gap-1.5" >
79- < div className = "code-panel__dot code-panel__dot--1" />
80- < div className = "code-panel__dot code-panel__dot--2" />
81- < div className = "code-panel__dot code-panel__dot--3" />
82- </ div >
83- < span className = "code-panel__filename text-xs font-mono opacity-80" >
84- { match ? match [ 1 ] : "text" }
85- </ span >
86- </ div >
87- < pre className = "code-panel__content p-5 overflow-x-auto text-sm md:text-[13px] leading-relaxed font-mono" >
88- < code className = { className } { ...props } >
89- { children }
90- </ code >
91- </ pre >
92- </ div >
93- ) ;
94- } ,
95- } ;
96-
97- export function BlogPost ( { post, className } : Props ) {
34+ export function BlogPost ( { post, className, children } : Props ) {
9835 return (
9936 < div className = { cn ( "relative z-10" , className ) } >
10037 { /* Subtle blur backdrop - reduced opacity to let background show through */ }
@@ -134,10 +71,8 @@ export function BlogPost({ post, className }: Props) {
13471 </ p >
13572 </ header >
13673
137- < article className = "space-y-2 pb-20 max-w-[680px] mx-auto" >
138- < ReactMarkdown components = { markdownComponents } >
139- { post . content }
140- </ ReactMarkdown >
74+ < article className = "blog-markdown pb-20 max-w-[680px] mx-auto" >
75+ { children }
14176 </ article >
14277
14378 < div className = "border-t border-border/70 pt-10 pb-16" >
0 commit comments