-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (28 loc) · 896 Bytes
/
index.js
File metadata and controls
32 lines (28 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import Link from 'next/link'
import Layout from '@/components/Layout'
import Post from '@/components/Post'
import { getPosts } from '@/lib/posts'
export default function HomePage({ posts }) {
return (
<Layout>
<h1 className='text-5xl border-b-4 p-5 font-bold'>Latest Posts</h1>
<div className='grid md:grid-cols-2 lg:grid-cols-3 gap-5'>
{posts.map((post, index) => (
<Post key={index} post={post} />
))}
</div>
<Link href='/blog'>
<a className='block text-center border border-gray-500 text-gray-800 rounded-md py-4 my-5 transition duration-500 ease select-none hover:text-white hover:bg-gray-900 focus:outline-none focus:shadow-outline w-full'>
All Posts
</a>
</Link>
</Layout>
)
}
export async function getStaticProps() {
return {
props: {
posts: getPosts().slice(0, 6),
},
}
}