This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
New Image component #114
Open
benjaminsehl
wants to merge
11
commits into
2023-01
Choose a base branch
from
bs/image
base: 2023-01
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New Image component #114
Conversation
This file contains 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
4 tasks
| 'bottom' | ||
| 'left' | ||
| 'right' | ||
| {top: number; left: number; width: number; height: number} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is meant to match what the SF API refers to as CropRegion (https://shopify.dev/api/storefront/2022-07/enums/CropRegion) which is used as an argument in generating image transforms (https://shopify.dev/api/storefront/2022-07/input-objects/ImageTransformInput)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being the case the additional arguments would actually show up later as separate loader arguments
I'd expect to see the new args show up here:
|
7 tasks
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
<Image />
now supports all unit types, and a more natural set of APIs (better aligned with standard HTML) for both for responsive and fixed with images.Example markup:
Would result in:
Sometimes you will just want a fixed sized image — we still generate
srcset
for this, however, as different devices have different pixel densities. We also account for the compound property common on all our other components,data
so you can simply pass the response from the Storefront API and set the width.So this:
Would result in:
Notice that even though we didn't pass in an
aspectRatio
prop, we were still able to generate a correctstyle
property, by usingdata.width
anddata.height
.Todo:
data
propPicture Element
Picture component should look something like:
When inside the component should render a
Before submitting the PR, please make sure you do the following:
fixes #123
)yarn changeset add
if this PR cause a version bump based on Keep a Changelog. If you have a breaking change, it will need to wait until the next major version release. Otherwise, use patch updates even for new features. Read more about Hydrogen-UI's versioning.