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 size for the collapsible content #2507

Merged
merged 7 commits into from
May 1, 2023

Conversation

eugenekasimov
Copy link
Contributor

@eugenekasimov eugenekasimov commented Apr 10, 2023

PR Summary:

This PR improves the way images are loaded in the collapsible content section.

Why are these changes introduced?

Fixes #1944.

What approach did you take?

I rewrote the logic of how we create our srcset and choose sizes.

Other considerations

Decision log

# Decision Alternatives Rationale Downsides
1

Visual impact on existing themes

Testing steps/scenarios

  • Add the collapsible content section and upload an image.
  • Check the rendered image size for different screen sizes. Make sure the image has a proper rendered size.
  • Test it for mobile layout.
  • In the collapsible content section settings change Layout to section container and make sure that this is accounted.

Demo links

Checklist

@eugenekasimov eugenekasimov self-assigned this Apr 11, 2023
@kmeleta kmeleta requested review from martinamarien and kmeleta and removed request for martinamarien April 14, 2023 14:52
@ludoboludo ludoboludo self-requested a review April 21, 2023 13:54
Copy link
Contributor

@kmeleta kmeleta left a comment

Choose a reason for hiding this comment

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

Did a first pass and the sizes look like they're working well. Just have some cosmetic code suggestions to consider. Otherwise looks gtg.

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.

I agree with Ken about the variable names that could be a bit clearer maybe 🤔

| image_tag:
loading: 'lazy',
sizes: sizes,
widths: '50, 75, 100, 150, 200, 300, 400, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3200'
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure it makes sense to add that many extra sizes 🤔 Though it doesn't have a negative impact either.

The only time it's going to be useful is if someone uses the section and removed the collapsible blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's fair what you say. I added the same bunch of numbers as we did for other sections, just because I want to make it into a snippet one day, even though some sections don't require that range.

@eugenekasimov eugenekasimov requested a review from kmeleta April 28, 2023 19:40
if section.settings.layout == 'section'
assign padding_multiplier = 2
endif
assign desktop_tablet_padding = padding_multiplier | times: 100 | 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.

Nitpick, but might read a little better if you did 100 | times: multiplier. Non-issue though if you don't agree. Otherwise I like it.

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed ^

@eugenekasimov eugenekasimov merged commit b7de2c2 into main May 1, 2023
@eugenekasimov eugenekasimov deleted the fix-image-size-collapsible-content branch May 1, 2023 16:01
phapsidesGT pushed a commit to Gravytrain-UK/gt-shopify-dawn-theme that referenced this pull request Sep 3, 2024
* Fix improper image size for collapsible content

* Refactoring and renaming variables.

* Fix prettier issue.

* Minor refactor.
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.

Suboptimal image sizes in sections
3 participants