18 lines
447 B
TypeScript
18 lines
447 B
TypeScript
/** 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>
|
||
|
|
);
|
||
|
|
}
|