import { getPosts, Post } from '@/lib/getPosts';
import { FC, use } from 'react';

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>
          {p.message &&
            p.message
              .split('\n')
              .map((para, i) => para && <p key={i}>{para}</p>)}
        </div>
      ))}
    </>
  );
};

export default Posts;
