Skip to content

Commit

Permalink
Fix FeaturedProjects preview images bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Graule committed Aug 14, 2024
1 parent c2c5046 commit b686151
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions frontend/src/app/_homeComponents/FeaturedProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ export default async function FeaturedProjects() {
featuredProjects?.featuredProject3,
];

let image_url = undefined;
if (STRAPI_URL) {
image_url =
STRAPI_URL +
featuredProjects?.featuredProject1?.data?.attributes?.previewImage
?.data?.attributes?.url;
}

return (
<PagePaddingOnlyHorizontal>
<div className="mb-16 flex w-full flex-col justify-center gap-2">
Expand All @@ -50,6 +42,13 @@ export default async function FeaturedProjects() {
if (!project?.data?.attributes?.title) {
return null;
}
let previewImage =
project?.data?.attributes?.previewImage?.data?.attributes
?.url;

if (STRAPI_URL && previewImage != undefined) {
previewImage = STRAPI_URL + previewImage;
}
return (
<CardWithContent
key={index.toString()}
Expand All @@ -58,7 +57,7 @@ export default async function FeaturedProjects() {
"/projects/" +
project?.data?.attributes?.slug
}
imageURL={image_url}
imageURL={previewImage}
></CardWithContent>
);
})}
Expand Down

0 comments on commit b686151

Please sign in to comment.