depot/web/lukegbcom/lib/PostsList/index.js

32 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-04-05 02:18:57 +00:00
import { mdxComponents } from '../posts-edge'
2022-04-03 23:32:57 +00:00
import Link from 'next/link'
2022-04-05 02:18:57 +00:00
import { MDXRemote } from 'next-mdx-remote'
2022-04-03 23:32:57 +00:00
import styles from './index.module.scss'
export default function LatestPosts({ posts }) {
return (
<div className={styles.container}>
<ul className={styles.postsList}>
{posts.map((post) => (
<li className={styles.post} key={post.slug}>
<div>
<Link href={`/posts/${encodeURIComponent(post.slug)}`}>
<a>
<h3 className={styles.postHeader}>{post.title}</h3>
</a>
</Link>
<time className={styles.postTimestamp}>{post.date.toString()}</time>
2022-04-05 02:18:57 +00:00
<div className={styles.postBlurb}><MDXRemote {...post.excerptMdx} components={mdxComponents} /></div>
2022-04-03 23:32:57 +00:00
<Link href={`/posts/${encodeURIComponent(post.slug)}`}>
<a className={styles.postReadMoreButtonLink}>
<span role="button" className={styles.postReadMoreButton}>Read More </span>
</a>
</Link>
</div>
</li>
))}
</ul>
</div>
)
2022-04-05 02:18:57 +00:00
}