--- import { getLastProjects } from "@/content/projects/projects"; import { getSettings } from "@/content/settings/settings"; import CalendarIcon from "@/icons/CalendarIcon.astro"; import { getImageSize, getImageUrl } from "@/lib/images"; import { getProjectRoute } from "@/lib/routing"; import { Image } from "astro:assets"; interface Props { projects: LastProjectsComponent; } function calculateSizeClasses(amount: number, length: number) { if (amount === 2 || length <= 2) { return "lg:w-[45%] w-full"; } else { return "lg:w-[31%] w-full"; } } const projects = Astro.props.projects; const settings = await getSettings(); const lastProjects = await getLastProjects(projects.amount); const size = calculateSizeClasses(projects.amount, lastProjects.length); --- { (settings.project.enabled && lastProjects.length > 0) && (

{projects.title}

{projects.readMoreButtonText}
{ lastProjects.map((project) => { const imageSize = getImageSize(project.searchEngine.thumbnail.width, project.searchEngine.thumbnail.height, 0.5); return ( {project.title}

{project.title}

{project.date}
) }) }
) }