-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import Link from 'next/link' | ||
import siteMetadata from '@/data/siteMetadata' | ||
|
||
const RelatedPosts = ({ posts }) => { | ||
if (!posts || posts.length === 0) return null | ||
|
||
return ( | ||
<div className="my-2 rounded-lg bg-gray-100 py-4 pl-4 pr-4 dark:bg-gray-800 xl:py-8"> | ||
<h2 className="toc-ignore mb-2 text-base font-bold uppercase tracking-wide text-gray-800 dark:text-gray-200"> | ||
Related Tags Posts | ||
</h2> | ||
{posts.map((post, index) => ( | ||
<div key={post.slug} className="py-2"> | ||
<div className="flex flex-row content-center justify-start space-x-6"> | ||
<div className="min-w-[80px] text-xs font-semibold text-rose-400"> | ||
{new Date(post.date).toLocaleDateString(siteMetadata.locale, { | ||
year: 'numeric', | ||
month: '2-digit', | ||
day: '2-digit', | ||
})} | ||
</div> | ||
<Link key={index} href={`/blog/${post.slug}`}> | ||
<a className="truncate text-sm font-semibold text-gray-500 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-300"> | ||
{post.title} | ||
</a> | ||
</Link> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
) | ||
} | ||
|
||
export default RelatedPosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters