2022-11-06 21:16:09 +01:00
|
|
|
'use client-only';
|
|
|
|
|
|
|
|
import { Post } from '@/lib/getPosts';
|
|
|
|
import { FC } from 'react';
|
|
|
|
import ReactMarkdown from 'react-markdown';
|
|
|
|
import remarkGfm from 'remark-gfm';
|
2022-11-06 21:07:22 +01:00
|
|
|
|
|
|
|
interface PostProps {
|
|
|
|
posts: Post[];
|
|
|
|
}
|
|
|
|
const Posts: FC<PostProps> = ({ posts }) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{posts.map((p) => (
|
|
|
|
<div className="space-y-2 text-white">
|
|
|
|
<p className="font-bold">{p.author.name}</p>
|
|
|
|
<p>{p.title}</p>
|
2022-11-06 21:16:09 +01:00
|
|
|
<div>
|
|
|
|
{p.message && (
|
|
|
|
<ReactMarkdown children={p.message} remarkPlugins={[remarkGfm]} />
|
|
|
|
)}
|
|
|
|
</div>
|
2022-11-06 21:07:22 +01:00
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Posts;
|