Skip to content

Fix theme catalogue card images#2227

Merged
sarah11918 merged 6 commits into
mainfrom
sarah-theme-card
Mar 6, 2026
Merged

Fix theme catalogue card images#2227
sarah11918 merged 6 commits into
mainfrom
sarah-theme-card

Conversation

@sarah11918

@sarah11918 sarah11918 commented Mar 5, 2026

Copy link
Copy Markdown
Member

Updated solution: replace width and height with inferSize as a temporary solution because the images for the theme catalogue cards were oddly cropped.

Also, thanks Firebase Studio 😅

Original message:

I don't know why the deploy preview won't show our theme pages, but working locally removing the height={400} seems to fix the image displays.

Current theme cards:

image

After removing height from theme cards:

image

Will note that setting a layout property did not fix the issue, neither on the <Image /> component in the <ThemeCard> nor as an image configuration option. The only thing that worked was removing either the height or the width.

Browser Test Checklist

I have tested this PR on at least three of the following browsers:

  • Chrome / Chromium
  • Firefox
  • Android Firefox
  • Safari
  • iOS Safari

Note: I am also trying to get this to work in IDX, so am experimenting with a dev.nix file, too.

@netlify

netlify Bot commented Mar 5, 2026

Copy link
Copy Markdown

Deploy Preview for astro-www-2 ready!

Name Link
🔨 Latest commit 826600a
🔍 Latest deploy log https://app.netlify.com/projects/astro-www-2/deploys/69ab46506b4e3f00087cea08
😎 Deploy Preview https://deploy-preview-2227--astro-www-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread .idx/dev.nix
@ArmandPhilippot

Copy link
Copy Markdown
Member

I'm not sure why the page doesn't work. Maybe there is an uncaught runtime error or something like that because of the <Image /> component? I mean the image is not imported so both width and height are required. I would expect MissingImageDimension to be thrown at build time for that...

Locally, I noticed Typescript wasn't complaining about the missing height! Actually, the Astro.props type is never inferred and so, image is typed as any! The component doesn't know src is a string and doesn't complain about the missing height.

Using

type Props<T extends HTMLTag = "h3"> = Polymorphic<{as: T;}> & {
	theme: ThemeAndAuthor;
};

fixes the inference!

Now, for the actual issue, I'm not sure what has changed but you're right the dimensions seem to be the issue. Replacing both width and height with inferSize seems to fix the issue in dev mode. And, yeah, layout does nothing for me neither (even after removing the Tailwind classes)...

@sarah11918

Copy link
Copy Markdown
Member Author

Thanks @ArmandPhilippot - replacing width and height with inferSize does make the Netlify preview happy now! 🙌

Is this good enough to at least make the theme cards look better now? 😄

@sarah11918 sarah11918 marked this pull request as ready for review March 6, 2026 20:56
@sarah11918

Copy link
Copy Markdown
Member Author

Will note, that although it's stupid to have this IDX file in here, someone with the same problem I had (Firebase Studio would simply just ignore any dev.nix file they made) stated that the solution needed to be merging this file in to their main branch separately, and only then, when the branch was opened in Firebase Studio with this file, was it actually recognized and the packages were included.

So, I kind of do need this IDX file merged in at some point to be able to test that theory. 😅

@ArmandPhilippot ArmandPhilippot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if inferSize is the best solution, but at least this works! I expected layout to work here... maybe this is related to the Netlify adapter or remote/public images. I don't know and I don't see any alternatives, so this LGTM!

And, I don't mind the IDX file. I mean for an occasional contributor this is probably too much but you're often in this repo... so, this makes sense to me if this helps you!

Still, this is odd we don't get any error because of a missing width or height... I'll try to reproduce that because this looks like a bug to me. Hopefully this is not related to Netlify because this might be harder to reproduce. 😅

@sarah11918 sarah11918 changed the title WIP - theme catalogue cards Fix theme catalogue card images Mar 6, 2026
@sarah11918 sarah11918 merged commit ce233f0 into main Mar 6, 2026
6 checks passed
@sarah11918 sarah11918 deleted the sarah-theme-card branch March 6, 2026 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants