diff --git a/solutions/blog/app/components/posts.tsx b/solutions/blog/app/components/posts.tsx new file mode 100644 index 0000000..77778b3 --- /dev/null +++ b/solutions/blog/app/components/posts.tsx @@ -0,0 +1,36 @@ +import Link from 'next/link' + import { formatDate, getBlogPosts } from 'app/blog/utils' + + export function BlogPosts() { + let allBlogs = getBlogPosts() + + return ( +
+ {allBlogs + .sort((a, b) => { + if ( + new Date(a.metadata.publishedAt) > new Date(b.metadata.publishedAt) + ) { + return -1 + } + return 1 + }) + .map((post) => ( + +
+

+ {formatDate(post.metadata.publishedAt, false)} +

+

+ {post.metadata.title} +

+
+ + ))} +
+ ) + }