mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
ref(global) update project structure
This commit is contained in:
32 files changed
+67
-42
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import React from 'react';
|
||||
import Markdown from 'react-markdown';
|
||||
import { Card, CardBody } from '@nextui-org/card';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import rehypeHighlight from 'rehype-highlight';
|
||||
import rehypeSanitize from 'rehype-sanitize';
|
||||
import rehypeRaw from 'rehype-raw';
|
||||
import remarkToc from 'remark-toc';
|
||||
import remarkFrontmatter from 'remark-frontmatter';
|
||||
import axios from 'axios';
|
||||
|
||||
type Props = {
|
||||
id: string
|
||||
}
|
||||
|
||||
async function Generate(props: Props) {
|
||||
|
||||
let response: any;
|
||||
try {
|
||||
response = await axios(`${ process.env.BACKEND_URL }/get_post/${ props.id }`);
|
||||
} catch (e) {
|
||||
return (
|
||||
<Card className={ `w-full` }>
|
||||
<CardBody>
|
||||
Fatal: Failed to load the post.
|
||||
</CardBody>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
let post_data = response.data;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Card className={ `w-full max-w-full relative` }>
|
||||
<CardBody>
|
||||
<Markdown
|
||||
className={ `p-5 max-w-full text-justify text-pretty prose prose-sm dark:prose-invert md:prose-md lg:prose-lg` }
|
||||
remarkPlugins={ [ remarkGfm, remarkToc, remarkFrontmatter ] }
|
||||
rehypePlugins={ [ rehypeHighlight, rehypeRaw, rehypeSanitize ] }
|
||||
>{ (post_data as any)['content'] }</Markdown>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Generate;
|
||||
Reference in new issue
Block a user