mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-05-19 07:42:43 +00:00
27 lines
661 B
TypeScript
27 lines
661 B
TypeScript
import React from "react"
|
|
import { Streamdown } from "streamdown"
|
|
|
|
const components = {
|
|
p: ({ children, ...props }: React.ComponentPropsWithoutRef<"p">) => {
|
|
const hasDiv = React.Children.toArray(children).some(
|
|
(child) =>
|
|
React.isValidElement(child) &&
|
|
typeof child.type === "string" &&
|
|
child.type === "div",
|
|
)
|
|
|
|
if (hasDiv) {
|
|
return <div {...props}>{children}</div>
|
|
}
|
|
|
|
return <p {...props}>{children}</p>
|
|
},
|
|
} as const
|
|
|
|
export function NotionDoc({ content }: { content: string }) {
|
|
return (
|
|
<div className="p-4 overflow-y-auto flex-1 scrollbar-thin">
|
|
<Streamdown components={components}>{content}</Streamdown>
|
|
</div>
|
|
)
|
|
}
|