reworked astro collections

This commit is contained in:
2025-06-22 05:28:44 +02:00
parent 459873f0e5
commit 9628eea874
16 changed files with 381 additions and 169 deletions

View File

@@ -1,7 +1,7 @@
---
// Import necessary components and utilities
import MarkdownComponent from "./MardownContent.astro";
import { getStrapiMedia } from "../utils/strapi";
import { getStrapiMedia } from "../lib/strapi";
import { getStrapiBaseUrl } from "../config/strapi";
import type { HTMLAttributes } from "astro/types";
@@ -18,19 +18,20 @@ const BASE_URL = getStrapiBaseUrl();
<div {...otherProps}>
{
elements.map((poleElement) => (
console.log(poleElement),
<a href={`/elements/${poleElement.id}`} class="block">
<article class="flex items-center bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-200">
<img
src={getStrapiMedia(
poleElement.data.mainImage.url,
poleElement.mainImage.url,
BASE_URL,
)}
alt={poleElement.data.mainImage.alternativeText}
alt={poleElement.mainImage.alternativeText}
class="w-24 h-24 object-cover flex-shrink-0"
/>
<div class="p-4">
<h2 class="text-xl font-bold">
{poleElement.data.name}
{poleElement.name}
</h2>
</div>
</article>