Fix thumbnail size for Last Projects

This commit is contained in:
itsfinniii
2026-04-05 22:50:38 +02:00
parent 07d2c8628f
commit ee949aa76f

View File

@@ -2,7 +2,7 @@
import { getLastProjects } from '@/content/projects/projects';
import { getSettings } from '@/content/settings/settings';
import CalendarIcon from '@/icons/CalendarIcon.astro';
import { getImageUrl } from '@/lib/images';
import { getImageSize, getImageUrl } from '@/lib/images';
import { getProjectRoute } from '@/lib/routing';
import { Image } from 'astro:assets';
@@ -43,14 +43,16 @@ const size = calculateSizeClasses(projects.amount, lastProjects.length);
</div>
<div class="flex flex-col lg:flex-row lg:justify-between gap-y-6">
{ lastProjects.map((project) => (
{ lastProjects.map((project) => {
const imageSize = getImageSize(project.searchEngine.thumbnail.width, project.searchEngine.thumbnail.height, 0.5);
<a href={getProjectRoute(settings.project, project)} class={`${size} flex flex-col gap-2`}>
<Image
src={getImageUrl(project.searchEngine.thumbnail.url)}
alt={project.title}
class="flex rounded-2xl shadow-md w-full"
width={600}
height={315}
width={imageSize.width}
height={imageSize.height}
/>
<h4 class="font-semibold text-[28px]">{project.title}</h4>
<div class="flex flex-row items-center gap-1.5 text-neutral-900 text-sm">
@@ -58,7 +60,7 @@ const size = calculateSizeClasses(projects.amount, lastProjects.length);
<div>{project.date}</div>
</div>
</a>
)) }
}) }
</div>
</div>
) }