This commit is contained in:
41
src/components/PostEntry.tsx
Normal file
41
src/components/PostEntry.tsx
Normal file
@ -0,0 +1,41 @@
|
||||
import { Post } from 'types/payload-types'
|
||||
import Image from 'next/image'
|
||||
|
||||
interface Props {
|
||||
post: Post
|
||||
}
|
||||
|
||||
export default function PostEntry(props: Props) {
|
||||
if (typeof props.post.thumbnail === 'string') return
|
||||
|
||||
return (
|
||||
<a className="py-4 border-secondary decoration-transparent" href={`/posts/${props.post.slug}`}>
|
||||
<article className="flex px-5 py-3 gap-8">
|
||||
<Image
|
||||
src={props.post.thumbnail.url || ''}
|
||||
width={150}
|
||||
height={150}
|
||||
alt={props.post.thumbnail.alt || ''}
|
||||
layout="fixed"
|
||||
/>
|
||||
|
||||
<div className="flex flex-col gap-4 w-full">
|
||||
<div className="flex justify-between w-full">
|
||||
<h3 className="">{props.post.title}</h3>
|
||||
{props.post.publishedDate && (
|
||||
<p className="font-light">
|
||||
{new Date(props.post.publishedDate).toLocaleDateString('de-DE')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{props.post.summary && <p className="max-w-prose">{props.post.summary}</p>}
|
||||
</div>
|
||||
{/* {props.post.author.name && (
|
||||
<p>
|
||||
{props.post.author.name}
|
||||
</p>
|
||||
)} */}
|
||||
</article>
|
||||
</a>
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user