[Woo POS] Hide cart images when the view is too narrow #15028
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.
Description
This PR adds a minimum width criteria for showing the images on CartItems, as they are often shown in a fairly constrained width, especially in portrait or landscape 2/3rds views.
1/2 landscape view on a 13" iPad never shows images – it's pretty rough even at the smallest sizes if we show them, at least when there's a remove button shown as well. On the Checkout screen it looks like there's space, but it's strange for the cart items to change as you move between those two screens.
The dynamicTypeSize and width go together to decide whether the images should be shown, so the minimum width changes depending on your current type size.
Note that I chose to do the calculations on the cart, not each image. It just felt bad for performance to have lots of views using geometry readers to calculate the exact same answer... but it would be nicer from a code-readability perspective to have it on the item cards.
Another nice step would be to update
DynamicHStack
to respond to width constraints as well – at the moment, moving to an accessibilty size avoids theCart
title having to wrap, but we could do that at smaller sizes when in a narrower display mode. I think that should be done separately though.Steps to reproduce
Explore different screen size splits, orientations, and dynamic type sizes.
Testing information
I've tested this by moving between the item list and checkout, in portrait, landscape 2/3rds, and landscape views.
I used an iPad Air on 17.5, an iPad mini simulator, and an iPad Air 13" simulator.
Screenshots
remove.image.in.split.view.mp4
RELEASE-NOTES.txt
if necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: