feat: Integrate forum layout support across various components and enhance room handling logic
This commit is contained in:
27
src/app/features/forum/ForumMessageBody.tsx
Normal file
27
src/app/features/forum/ForumMessageBody.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import React from 'react';
|
||||
import { Text } from 'folds';
|
||||
import * as theme from './forumTheme.css';
|
||||
|
||||
type ForumMessageBodyProps = {
|
||||
body: string;
|
||||
bodyHtml?: string;
|
||||
};
|
||||
|
||||
export function ForumMessageBody({ body, bodyHtml }: ForumMessageBodyProps) {
|
||||
const plain = body.trim();
|
||||
if (bodyHtml) {
|
||||
return (
|
||||
<div
|
||||
className={theme.ForumMessageBodyRich}
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: bodyHtml }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
if (!plain) return null;
|
||||
return (
|
||||
<Text as="p" className={theme.ForumMessageBody} size="T400">
|
||||
{body}
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user