Skip to content

Commit

Permalink
Create posts.tsx
Browse files Browse the repository at this point in the history
Signed-off-by: gitworkflows <118260833+gitworkflows@users.noreply.github.com>
  • Loading branch information
gitworkflows authored Apr 11, 2024
1 parent 90af2ab commit a684bc9
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions solutions/blog/app/components/posts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import Link from 'next/link'
import { formatDate, getBlogPosts } from 'app/blog/utils'

export function BlogPosts() {
let allBlogs = getBlogPosts()

return (
<div>
{allBlogs
.sort((a, b) => {
if (
new Date(a.metadata.publishedAt) > new Date(b.metadata.publishedAt)
) {
return -1
}
return 1
})
.map((post) => (
<Link
key={post.slug}
className="flex flex-col space-y-1 mb-4"
href={`/blog/${post.slug}`}
>
<div className="w-full flex flex-col md:flex-row space-x-0 md:space-x-2">
<p className="text-neutral-600 dark:text-neutral-400 w-[100px] tabular-nums">
{formatDate(post.metadata.publishedAt, false)}
</p>
<p className="text-neutral-900 dark:text-neutral-100 tracking-tight">
{post.metadata.title}
</p>
</div>
</Link>
))}
</div>
)
}

1 comment on commit a684bc9

@vercel
Copy link

@vercel vercel bot commented on a684bc9 Apr 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hand-pickr – ./

hand-pickr-devsec.vercel.app
hand-pickr.vercel.app
hand-pickr-git-main-devsec.vercel.app

Please sign in to comment.