index.tsx20 lines · main
| 1 | 'use client' |
| 2 | |
| 3 | import Image from 'next/image' |
| 4 | import { cn } from 'ui' |
| 5 | import { CodeBlock } from 'ui-patterns/CodeBlock' |
| 6 | |
| 7 | const NextImageHandler = (props: any) => { |
| 8 | return ( |
| 9 | <span className={cn('next-image--dynamic-fill', props.className)}> |
| 10 | <Image {...props} className={['rounded-md border'].join(' ')} layout="fill" /> |
| 11 | </span> |
| 12 | ) |
| 13 | } |
| 14 | |
| 15 | export const markdownComponents = { |
| 16 | mono: (props: any) => <code className="text-sm">{props.children}</code>, |
| 17 | code: (props: any) => <CodeBlock {...props} />, |
| 18 | img: (props: any) => NextImageHandler(props), |
| 19 | Image: (props: any) => NextImageHandler(props), |
| 20 | } |