Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picture Component #115

Open
mynameisadamf opened this issue Oct 21, 2022 · 4 comments
Open

Picture Component #115

mynameisadamf opened this issue Oct 21, 2022 · 4 comments
Labels

Comments

@mynameisadamf
Copy link

Motivation

Right now we are pulling in 1 media asset for a product or collection across small/medium/large screens. This 1 asset with no focal point can lead to bad cropping.

See decapitated snowboarder
Image

Opportunity

  1. Allow merchants and developers to manually select or dynamically detect a focal point at a media level (product or collection)
  2. Allow hydrogen to detect an image component selected focal point

Brainstorm features & functionality:

@mynameisadamf mynameisadamf added this to the 5. Polished Demo Store milestone Oct 21, 2022
@benjaminsehl benjaminsehl removed this from the 5. Polished Demo Store milestone Nov 7, 2022
@benjaminsehl benjaminsehl changed the title Image focal point data in image component [WIP] Picture component w/ focal point support May 1, 2023
@benjaminsehl
Copy link
Member

 <Picture
  width="100%"
  {...props}>
  <Source 
      src={data.src} 
      aspectRatio="4/5" 
      sizes="100vw" 
      media="(min-width: 30em)" />        
  <Image 
      src={data.src} 
      aspectRatio="2/3" 
      sizes="100vw" 
      media="(min-width: 45em)" />
  <Image 
      src={data.src} 
      aspectRatio="1/1" 
      sizes="100vw" />
</Picture>

A DX similar to this would be ideal. We should also have crop="focal_point" support (via MediaPresentation object); have connected with @richardmonette previously on this with some thoughts.

@benjaminsehl benjaminsehl changed the title [WIP] Picture component w/ focal point support Picture Component May 8, 2023
@benjaminsehl
Copy link
Member

I'd also be curious to take the opportunity to look at a CSS-only blurhash; which @frehner proposed previously. This looked pretty interesting to me: https://joebell.co.uk/blog/loading-images-with-the-blur-down-technique.

Or at very least, provide an example for it.

@benjaminsehl benjaminsehl modified the milestone: 2023-07 May 17, 2023
@blittle blittle added Idea and removed New to 2.0 labels May 28, 2024
@blittle
Copy link
Contributor

blittle commented May 28, 2024

Draft implementation of focal point: #2139

@benjaminsehl
Copy link
Member

Reviving this image — 

We ideally need:

This also needs to all work within a single component and be automatic for you. We would support <Image crop="focal-point" aspectRatio="3/2" /> and we'd also have <Picture> … as described above.

We'd also make it possible for above the fold images to be automatically preloaded, so we can render faster, as is in #2061 — in a dream world you'd just do <Image eager /> or something, since our default images should still be lazy loaded … and then a <Link /> component that Hydrogen exports would auto figure stuff out for you. Everything described in the preloading PR should be a no-op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants