Ensure "no posts" message doesn't get placed in ul

This commit is contained in:
Maciej Pędzich 2023-05-13 08:40:23 +02:00
parent 6a35c00298
commit d5a7b418a3

View File

@ -16,16 +16,22 @@ const posts = (
).sort((a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()); ).sort((a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf());
--- ---
<ul class="post-list"> {
{ posts.length === 0 ? (
posts.length === 0 ? ( <p id="no-posts-found">No posts were found...</p>
<p>No posts were found</p> ) : (
) : ( <ul class="post-list">
posts.map((post) => ( {posts.map((post) => (
<li> <li>
<a href={`/blog/${post.slug}`}>{post.data.title}</a> <a href={`/blog/${post.slug}`}>{post.data.title}</a>
</li> </li>
)) ))}
) </ul>
)
}
<style>
#no-posts-found {
text-align: center;
} }
</ul> </style>