Skip to content

Commit

Permalink
Refactor MarkdownContent image
Browse files Browse the repository at this point in the history
  • Loading branch information
mirhamasala committed Oct 7, 2024
1 parent 367cdc6 commit 9311ef5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/app/_components/MarkdownContent.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Image from 'next/image'

import ReactMarkdown from 'react-markdown'
import rehypeRaw from 'rehype-raw'
import remarkGfm from 'remark-gfm'
Expand All @@ -6,8 +8,6 @@ import { graphicsData } from '@/data/graphicsData'

import { buildImageSizeProp } from '@/utils/buildImageSizeProp'

import { DynamicImage } from '@/components/DynamicImage'

type MarkdownContentProps = {
children: string
}
Expand All @@ -20,12 +20,12 @@ export function MarkdownContent({ children }: MarkdownContentProps) {
className="prose"
components={{
img: ({ src, alt }) => (
<DynamicImage
src={src || ''}
alt={alt || ''}
<Image
priority
src={src || graphicsData.imageFallback.data.src}
alt={!src ? graphicsData.imageFallback.alt : alt || ''}
width={800}
height={450}
fallback={graphicsData.imageFallback}
sizes={buildImageSizeProp({ startSize: '100vw', md: '660px' })}
/>
),
Expand Down

0 comments on commit 9311ef5

Please sign in to comment.