Files
lettersoup-online/002_source/cms/src/components/dashboard/blog/content.tsx
louiscklaw 6c931c1fe8 build ok,
2025-04-14 09:26:24 +08:00

28 lines
847 B
TypeScript

import * as React from 'react';
import Box from '@mui/material/Box';
import Markdown from 'react-markdown';
import type { Components } from 'react-markdown';
import { CodeHighlighter } from '@/components/core/code-highlighter';
const components = { code: CodeHighlighter as Components['code'] } satisfies Components;
export interface ContentProps {
content: string;
}
export function Content({ content }: ContentProps): React.JSX.Element {
return (
<Box
sx={{
'& h2': { fontWeight: 500, fontSize: '1.5rem', lineHeight: 1.2, mb: 3 },
'& h3': { fontWeight: 500, fontSize: '1.25rem', lineHeight: 1.2, mb: 3 },
'& p': { fontWeight: 400, fontSize: '1rem', lineHeight: 1.5, mb: 2, mt: 0 },
'& li': { mb: 1 },
}}
>
<Markdown components={components}>{content}</Markdown>
</Box>
);
}