Skip to content

Commit

Permalink
feat(home/grid): create "latest post" card
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 authored Apr 14, 2024
1 parent 6911b6d commit 2cb806a
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/app/_components/grid/cards/latest-post.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { posts } from '#content'
import Link from 'next/link'
import { Date } from '~/components/date'
import { getSortedPosts } from '~/lib/get-sorted-posts'

export function LatestPost() {
const { title } = {
title: 'My latest post dsdsadsadasdsadsa'
}

const latestPost = getSortedPosts(posts)[0]

const Divider = () => (
<span className="h-px w-full rounded-full bg-sky-700 opacity-20 dark:bg-sky-500" />
)

return (
<Link
href={`/blog/post/${latestPost.slug}`}
className="flex w-full flex-1 transform-gpu flex-col gap-3 overflow-hidden rounded-xl border-2 border-sky-700 bg-sky-50 p-5 transition-all duration-500 hover:scale-[.97] dark:border-sky-500 dark:bg-sky-950/50"
>
<span>Latest post</span>

<Divider />

<span className="overflow-hidden text-ellipsis whitespace-nowrap text-xl font-bold">
{latestPost.title}
</span>

<Divider />

<span className="opacity-70">
<Date dateString={latestPost.date} />
</span>
</Link>
)
}

0 comments on commit 2cb806a

Please sign in to comment.