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

Fix improper image sizes in the collage section #2478

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

eugenekasimov
Copy link
Contributor

@eugenekasimov eugenekasimov commented Mar 30, 2023

PR Summary:

This PR improves the way images are loaded in the collage section. It accounts for many factors that image sizes depend on.

Why are these changes introduced?

Fixes #2354.

What approach did you take?

I rewrote the logic of how we create our srcset and choose sizes. Now it accounts for the page width, desktop/tablet/mobile layouts, number of columns, size of the image in collage and paddings.

Other considerations

Decision log

# Decision Alternatives Rationale Downsides
1

Visual impact on existing themes

No visual impact

Testing steps/scenarios

  • Remove default blocks from the collage section and add three image blocks.
  • Check loaded sizes for all of three images. Try it for different screen sizes.
  • Change Desktop layout and Mobile layout. Try it for different screen sizes.
  • Remove one image/block and test previous steps with two images/blocks.
  • Remove two images/blocks and test previous steps with one image/block.

Demo links

Checklist

@eugenekasimov eugenekasimov marked this pull request as draft March 30, 2023 00:09
@eugenekasimov eugenekasimov force-pushed the fix-image-size-collage branch from 4d3c2bd to 5133ade Compare March 30, 2023 17:05
@eugenekasimov eugenekasimov marked this pull request as ready for review March 30, 2023 17:12
Copy link
Contributor

@ludoboludo ludoboludo left a comment

Choose a reason for hiding this comment

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

Looking good, just wondering about one more thing.

Comment on lines +51 to +52
assign grid_space_desktop = settings.spacing_grid_horizontal | divided_by: 2 | append: 'px'
assign grid_space_mobile = settings.spacing_grid_horizontal | divided_by: 4 | append: 'px'
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I'm wondering about. Why does it need to be divided by 2 and 4 🤔 Since the spacing is applied once

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because let's say there is a 40px gap, this 40px approximately equally split between 2 images. Since we are trying to calculate an image size we need to account it partially. If I account 40px for the first image only then the second image size will be calculated wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense 👍

@eugenekasimov eugenekasimov merged commit 903297d into main Apr 3, 2023
@eugenekasimov eugenekasimov deleted the fix-image-size-collage branch April 3, 2023 16:03
pangloss added a commit to pangloss/dawn that referenced this pull request Apr 5, 2023
* shopify/main:
  [Video] Add fade in on scroll animation (Shopify#2495)
  Animate rich text and email signup (Shopify#2408)
  [Gift card] Add help doc link and change label for translation (Shopify#2471)
  Add prettier config to support format-on-save (Shopify#2323)
  Announcements slideshow (Shopify#2394)
  fix: Update Follow on Shop Option Text (Shopify#2463)
  Enable "per-PR" async PR mode (Shopify#2488)
  Animate multicolumn (Shopify#2409)
  Fix improper image sizes in the collage section (Shopify#2478)
  Replaced depreciated liquid property/value (Shopify#2480)
pangloss added a commit to pangloss/dawn that referenced this pull request Apr 12, 2023
* next:
  [Video] Add fade in on scroll animation (Shopify#2495)
  Animate rich text and email signup (Shopify#2408)
  [Gift card] Add help doc link and change label for translation (Shopify#2471)
  Add prettier config to support format-on-save (Shopify#2323)
  Announcements slideshow (Shopify#2394)
  fix: Update Follow on Shop Option Text (Shopify#2463)
  Enable "per-PR" async PR mode (Shopify#2488)
  Animate multicolumn (Shopify#2409)
  Fix improper image sizes in the collage section (Shopify#2478)
  Replaced depreciated liquid property/value (Shopify#2480)
  Update from Shopify for theme dawn/next
  Update from Shopify for theme dawn/next
  Update from Shopify for theme dawn/next
  Update from Shopify for theme dawn/next
  Update from Shopify for theme dawn/next
  Update from Shopify for theme dawn/next
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Add logic for collage image sizes

* Add more logic and refactor.

* Refactoring
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.

Improper image sizes rendering in Collage sections.
3 participants