Files
nextload/src/components/PostEntry.tsx
tobias 4dfe80213e
Some checks failed
continuous-integration/drone/push Build is failing
Use collection config for slugs and correct locale for links
2024-06-24 09:55:03 +02:00

46 lines
1.3 KiB
TypeScript

import { Post } from 'types/payload-types'
import Image from 'next/image'
import { COLLECTION_SLUG_POST } from '@/app/(payload)/collections/config'
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={`/${COLLECTION_SLUG_POST}${props.post.path}`}
>
<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>
)
}