allow for collections using portrait trails #1590
Merged
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.
What's changed?
Currently, all trail images are required / expected to have a 5:3 (landscape) aspect ratio - as such this currently hardwired into parts of the
InputImage
component, such as the uri used to open the GridModal specifying the "imageType=landscape" query param (even though thecriteria
object specifying the expected dimensions is already a prop).There are plans to allow 4:5 portraint trail images for some containers, so the component needed to be generalised to allow for images matching other
criteria
to be selected.This PR doesn't make any user-facing changes, but refactors the
InputImage
component so it would work as expected if provided acriteria
prop representing 4:5 portrait images.Implementation notes
- removed the extra state and replaced with a method to extract the values from props.input.valueInputImage
needs extra state to track the dimension of its replacement image so it can style the image button in the right shape (using an<img>
and relying in the native image dimensions instead ofbackground-image
css might have removed the need for this, but this seemed like a less fiddly option)Testing
As written, there should be no changes in behaviour compared to main.
To test the mechanism locally, edit the value of
defaultCardTrailImageCriteria
toportraitCardImageCriteria
in fronts-client/src/constants/image.ts. With that change:Setting
defaultCardTrailImageCriteria=undefined
should allow you to select either 4:5 or 5:3 images.Checklist
General
Client