Skip to content

Commit

Permalink
fix: broken images on project and ecosystem cards
Browse files Browse the repository at this point in the history
  • Loading branch information
allison-truhlar committed May 28, 2024
1 parent cabb347 commit 64311a5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
Binary file added public/project-images/Bg0Geue-cY8-unsplash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/project-images/OqtafYT5kTw-unsplash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/project-images/f4pUuCc3M0g-unsplash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/components/projects/CardImage.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from "react";
import { getRandomImage } from "../../utils/getRandomImage";

export default function ContentCardImage() {
export default function ContentCardImage({ baseUrl }) {
const placeholderProjectImages = [
"Bg0Geue-cY8",
"f4pUuCc3M0g",
Expand All @@ -15,7 +15,7 @@ export default function ContentCardImage() {

return (
<img
src={`https://source.unsplash.com/${randomImage}`}
src={`${baseUrl}/project-images/${randomImage}-unsplash.jpg`}
className="w-full h-40 object-cover object-center"
loading="lazy"
/>
Expand Down
6 changes: 5 additions & 1 deletion src/pages/ecosystems/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ const uniqueTags = extractUniqueTagsObject(flattenedRelatedProjects);
slot="cardImage"
/>
) : (
<CardImage slot="cardImage" client:visible />
<CardImage
slot="cardImage"
baseUrl={baseUrl}
client:only="react"
/>
)}

<CardContent
Expand Down
6 changes: 5 additions & 1 deletion src/pages/projects/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ const uniqueTags = extractUniqueTagsObject(allProjects);
slot="cardImage"
/>
) : (
<CardImage slot="cardImage" client:load />
<CardImage
slot="cardImage"
baseUrl={baseUrl}
client:only="react"
/>
)}

<CardContent
Expand Down

0 comments on commit 64311a5

Please sign in to comment.