@@ -242,7 +242,7 @@ function NotificationCard({
242242 ref = { descriptionRef }
243243 className = { cn ( ! isExpanded && "line-clamp-3" ) }
244244 >
245- < ReactMarkdown components = { markdownComponents } > { description } </ ReactMarkdown >
245+ < ReactMarkdown components = { getMarkdownComponents ( onLinkClick ) } > { description } </ ReactMarkdown >
246246 </ div >
247247 { ( isOverflowing || isExpanded ) && (
248248 < button
@@ -269,25 +269,28 @@ function NotificationCard({
269269 ) ;
270270}
271271
272- const markdownComponents = {
273- p : ( { children } : { children ?: React . ReactNode } ) => (
274- < p className = "my-0.5 text-xs leading-relaxed text-text-dimmed" > { children } </ p >
275- ) ,
276- a : ( { href, children } : { href ?: string ; children ?: React . ReactNode } ) => (
277- < a
278- href = { href }
279- target = "_blank"
280- rel = "noopener noreferrer"
281- className = "text-indigo-400 underline hover:text-indigo-300 transition-colors"
282- >
283- { children }
284- </ a >
285- ) ,
286- strong : ( { children } : { children ?: React . ReactNode } ) => (
287- < strong className = "font-semibold text-text-bright" > { children } </ strong >
288- ) ,
289- em : ( { children } : { children ?: React . ReactNode } ) => < em > { children } </ em > ,
290- code : ( { children } : { children ?: React . ReactNode } ) => (
291- < code className = "rounded bg-charcoal-700 px-1 py-0.5 text-[11px]" > { children } </ code >
292- ) ,
293- } ;
272+ function getMarkdownComponents ( onLinkClick : ( ) => void ) {
273+ return {
274+ p : ( { children } : { children ?: React . ReactNode } ) => (
275+ < p className = "my-0.5 text-xs leading-relaxed text-text-dimmed" > { children } </ p >
276+ ) ,
277+ a : ( { href, children } : { href ?: string ; children ?: React . ReactNode } ) => (
278+ < a
279+ href = { href }
280+ target = "_blank"
281+ rel = "noopener noreferrer"
282+ className = "text-indigo-400 underline hover:text-indigo-300 transition-colors"
283+ onClick = { onLinkClick }
284+ >
285+ { children }
286+ </ a >
287+ ) ,
288+ strong : ( { children } : { children ?: React . ReactNode } ) => (
289+ < strong className = "font-semibold text-text-bright" > { children } </ strong >
290+ ) ,
291+ em : ( { children } : { children ?: React . ReactNode } ) => < em > { children } </ em > ,
292+ code : ( { children } : { children ?: React . ReactNode } ) => (
293+ < code className = "rounded bg-charcoal-700 px-1 py-0.5 text-[11px]" > { children } </ code >
294+ ) ,
295+ } ;
296+ }
0 commit comments