Skip to content

Commit 4a5713d

Browse files
committed
refactor: Remove unnecessary flex classes from CodeBlock component
1 parent 56b7121 commit 4a5713d

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

src/components/Common/CodeBlock.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Tooltip } from "antd"
22
import { CheckIcon, ClipboardIcon } from "lucide-react"
3-
import { FC, memo, useState } from "react"
3+
import { FC, useState } from "react"
44
import { useTranslation } from "react-i18next"
55
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"
66
import { coldarkDark } from "react-syntax-highlighter/dist/cjs/styles/prism"
@@ -10,7 +10,7 @@ interface Props {
1010
value: string
1111
}
1212

13-
export const CodeBlock: FC<Props> = memo(({ language, value }) => {
13+
export const CodeBlock: FC<Props> =({ language, value }) => {
1414
const [isBtnPressed, setIsBtnPressed] = useState(false)
1515
const { t } = useTranslation("common")
1616
return (
@@ -63,4 +63,4 @@ export const CodeBlock: FC<Props> = memo(({ language, value }) => {
6363
</div>
6464
</>
6565
)
66-
})
66+
}

src/components/Common/Markdown.tsx

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
11
import remarkGfm from "remark-gfm"
22
import remarkMath from "remark-math"
3-
import ReactMarkdown, { Options } from "react-markdown"
4-
3+
import ReactMarkdown from "react-markdown"
54
import "property-information"
65
import React from "react"
7-
import { Tooltip } from "antd"
8-
import { CheckIcon, ClipboardIcon } from "lucide-react"
9-
import { useTranslation } from "react-i18next"
10-
11-
import { FC, memo } from "react"
126
import { CodeBlock } from "./CodeBlock"
137

14-
export const MemoizedReactMarkdown: FC<Options> = memo(
15-
ReactMarkdown,
16-
(prevProps, nextProps) =>
17-
prevProps.children === nextProps.children &&
18-
prevProps.className === nextProps.className
19-
)
208

219
export default function Markdown({ message }: { message: string }) {
2210

2311
return (
2412
<React.Fragment>
25-
<MemoizedReactMarkdown
13+
<ReactMarkdown
2614
className="prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 dark:prose-dark"
2715
remarkPlugins={[remarkGfm, remarkMath]}
2816
components={{
@@ -55,7 +43,7 @@ export default function Markdown({ message }: { message: string }) {
5543
}
5644
}}>
5745
{message}
58-
</MemoizedReactMarkdown>
46+
</ReactMarkdown>
5947
</React.Fragment>
6048
)
6149
}

0 commit comments

Comments
 (0)