(feat) Img component - #39163
Closed
hestonhoffman wants to merge 6 commits into
Closed
Conversation
Contributor
|
Collaborator
Author
|
Closed in favor of #39214 (WIP) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an Img component:
images/content/**src/config/images.ts. Videos needed a separate import.Note: Because the image URLs paths pivot on
import.meta.env.PROD, you have to use yarn dev for the local images to render (yarn preview uses the prod environment).Image props
I carried over most of the props used in the Hugo shortcode.
href,target,wide,img_param,pop_param,figure_class, andfigure_style).styleprop withwidthPercentand added a validation error that prevents writers from using widthPercent with height/width.Things im unsure about
Images
yarn devfor them to render.Lightbox
I'm the least sure about this. I went back and forth with Claude for a bit on how I should implement the lightbox behavior. Wasn't sure about using a global interaction for all images vs some JS in the Img component itself (preact island?). Claude was concerned with the performance implications of adding the interaction to the component: "N hydrated islands on a page with N images — real JS cost multiplied by however many images are on the page, versus the global approach's flat one-time cost regardless of image count." I ended up going with the global option and wiring it into
BaseLayout. This bumped the island IDs and caused some snapshot noise.