Files
sorsfonalak/services/frontend/src/components/forum/PostBody.tsx
T

18 lines
447 B
TypeScript
Raw Normal View History

/** A post's text: paragraphs and line breaks as typed; links stay plain text. */
export function PostBody({ text }: { text: string }) {
return (
<div className="fp-body">
{text.split(/\n{2,}/).map((para, i) => (
<p key={i}>
{para.split("\n").map((line, j) => (
<span key={j}>
{j > 0 && <br />}
{line}
</span>
))}
</p>
))}
</div>
);
}