-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPost.js
57 lines (53 loc) · 1.68 KB
/
Post.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import Link from 'next/link'
import Image from 'next/image'
import CategoryLabel from './CategoryLabel'
export default function Post({ post, compact }) {
return (
<div className='w-full px-10 py-6 bg-white rounded-lg shadow-md mt-6'>
{!compact && (
<Image
src={post.frontmatter.cover_image}
alt=''
height={420}
width={600}
className='mb-4 rounded'
/>
)}
<div className='flex justify-between items-center'>
<span className='font-light text-gray-600'>
{post.frontmatter.date}
</span>
<CategoryLabel>{post.frontmatter.category}</CategoryLabel>
</div>
<div className='mt-2'>
<Link href={`/blog/${post.slug}`}>
<a className='text-2xl text-gray-700 font-bold hover:underline'>
{post.frontmatter.title}
</a>
</Link>
<p className='mt-2 text-gray600'>{post.frontmatter.excerpt}</p>
</div>
{!compact && (
<div className='flex justify-between items-center mt-6'>
<Link href={`/blog/${post.slug}`}>
<a className='text-gray-900 hover:text-blue-600'>Read More</a>
</Link>
<div className='flex space-x-4 items-center'>
<div className='hidden sm:block'>
<Image
src={post.frontmatter.author_image}
alt=''
width={40}
height={40}
className='object-cover rounded-full'
/>
</div>
<h3 className='text-gray-700 font-bold'>
{post.frontmatter.author}
</h3>
</div>
</div>
)}
</div>
)
}