Fixed showing cover image for latest post even if it does not exist
This commit is contained in:
parent
ba4e2dbd27
commit
fa527aeddb
1 changed files with 3 additions and 11 deletions
|
|
@ -11,16 +11,8 @@ type PostProps = {
|
|||
}
|
||||
|
||||
export function Post({ post, isLatest, showImageSlot }: PostProps) {
|
||||
const {
|
||||
title,
|
||||
description,
|
||||
category,
|
||||
date,
|
||||
coverImage,
|
||||
coverImageAlt,
|
||||
readingTimeText,
|
||||
slug,
|
||||
} = post
|
||||
const { title, description, category, date, coverImage, coverImageAlt, readingTimeText, slug } =
|
||||
post
|
||||
|
||||
if (!title || !description || !date) {
|
||||
return null
|
||||
|
|
@ -30,7 +22,7 @@ export function Post({ post, isLatest, showImageSlot }: PostProps) {
|
|||
|
||||
return (
|
||||
<article className={cn('flex flex-col gap-4', isLatest && 'items-center md:flex-row')}>
|
||||
{(isLatest || showImageSlot) && (
|
||||
{((isLatest && coverImage) || showImageSlot) && (
|
||||
<div className={isLatest && coverImage ? 'flex-1 w-full' : 'h-60'}>
|
||||
{coverImage && <ImageWrapper src={coverImage} alt={coverImageAlt ?? title} isListing />}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue