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) {
|
export function Post({ post, isLatest, showImageSlot }: PostProps) {
|
||||||
const {
|
const { title, description, category, date, coverImage, coverImageAlt, readingTimeText, slug } =
|
||||||
title,
|
post
|
||||||
description,
|
|
||||||
category,
|
|
||||||
date,
|
|
||||||
coverImage,
|
|
||||||
coverImageAlt,
|
|
||||||
readingTimeText,
|
|
||||||
slug,
|
|
||||||
} = post
|
|
||||||
|
|
||||||
if (!title || !description || !date) {
|
if (!title || !description || !date) {
|
||||||
return null
|
return null
|
||||||
|
|
@ -30,7 +22,7 @@ export function Post({ post, isLatest, showImageSlot }: PostProps) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article className={cn('flex flex-col gap-4', isLatest && 'items-center md:flex-row')}>
|
<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'}>
|
<div className={isLatest && coverImage ? 'flex-1 w-full' : 'h-60'}>
|
||||||
{coverImage && <ImageWrapper src={coverImage} alt={coverImageAlt ?? title} isListing />}
|
{coverImage && <ImageWrapper src={coverImage} alt={coverImageAlt ?? title} isListing />}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue