-
Notifications
You must be signed in to change notification settings - Fork 7
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
set criteria by collection type, style portrait thumbnails, validate on drop #1591
Conversation
…f the selected replacement image, use to style the ImageContainer
…ortraits in slideshows
…lay portraits right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have played with this locally and in CODE and it all works as expected. A couple of visual spacing issues, maybe?
Can we adjust the spacing, so the thumbnails are not overlapping?
It looks like this icon could use some right hand spacing. Also, just a question... is this the final icon or a placeholder? Seems an inconsistent choice given the crop icon generally represents re-cropping an image in our tools.
Good point, I must have missed that. I'll take a look.
It was intended as a placeholder, but you're right that its not ideal. I was thinking of it as a symbol for 'crops' in general, but that's not how it's used elsewhere. I think I'll swap the icon for a small badge component of some kind that can include the "5:4" text. |
Seen on PROD (merged by @dblatcher 6 minutes and 23 seconds ago) Please check your changes! |
…on drop (#1591) * use hard coded constant so all trails are required to be portrait * allow grid to select either image type, add state for the dimension of the selected replacement image, use to style the ImageContainer * bug fix? aspect ratio test should use absolute difference * use the criteria to set the gird url, not a separate prop * export the default trail image criteria from constants * remove unused imports * shorted var name, comments about use of constant criteria * add selectCollectionType selector * provide the collection type to the InputImage * add feature switch for whether to allow portrait crops * if the feature switch is enabled, set criteria based on collection type * dont change the FeatureSwitch class - just hide the new one client-side * provide criteria to slideshow * dont need state for imageDims - can get from props.input.value * remove collection type from render * use horrendous css funcions to style the image containers for small portraits in slideshows * wrangle the css for ImageContainer * move the image container to own file * validate image error distinguishes between 'no crops' and 'no matching crops' * dont use the default criteria * move constants to constants/image * Card components check the collection type to set criteria for image drops * add TO DO about dragging images from card to card * cards check replacement image dimensions and style thumbnails to display portraits right * validate dimensions of incoming dragged images from other cards * undo switch change * more coherent comments * update tests to account for more specific error messaging * message correctly when crops fail validation of a criteria without aspect ratio * refactor validation to reduce duplication of dimension criteria checks * add a crop icon next to the Collection title if it uses 5:4 crops * remove import * don't show the crop icon with feature switch off * remove test value from COLLECTIONS_USING_PORTRAIT_TRAILS * define type for empty string array
…on drop (#1591) * use hard coded constant so all trails are required to be portrait * allow grid to select either image type, add state for the dimension of the selected replacement image, use to style the ImageContainer * bug fix? aspect ratio test should use absolute difference * use the criteria to set the gird url, not a separate prop * export the default trail image criteria from constants * remove unused imports * shorted var name, comments about use of constant criteria * add selectCollectionType selector * provide the collection type to the InputImage * add feature switch for whether to allow portrait crops * if the feature switch is enabled, set criteria based on collection type * dont change the FeatureSwitch class - just hide the new one client-side * provide criteria to slideshow * dont need state for imageDims - can get from props.input.value * remove collection type from render * use horrendous css funcions to style the image containers for small portraits in slideshows * wrangle the css for ImageContainer * move the image container to own file * validate image error distinguishes between 'no crops' and 'no matching crops' * dont use the default criteria * move constants to constants/image * Card components check the collection type to set criteria for image drops * add TO DO about dragging images from card to card * cards check replacement image dimensions and style thumbnails to display portraits right * validate dimensions of incoming dragged images from other cards * undo switch change * more coherent comments * update tests to account for more specific error messaging * message correctly when crops fail validation of a criteria without aspect ratio * refactor validation to reduce duplication of dimension criteria checks * add a crop icon next to the Collection title if it uses 5:4 crops * remove import * don't show the crop icon with feature switch off * remove test value from COLLECTIONS_USING_PORTRAIT_TRAILS * define type for empty string array
What's changed?
Adds features (behind a feature switch) to the fronts tool to support some collection types using Portrait Crops for replacement trail images and/or slideshows
Utility code etc:
COLLECTIONS_USING_PORTRAIT_TRAILS
- in the "constants" folder. This can be populated with thecollectionType
of the new collection when implemented.Criteria
can be exported separately (as below, this is used to validate if a crop dragged from one card match the criteria of the card it was dropped onComponent behaviour:
Card
collectionType
prop (mapped from app State) and adetermineCardCriteria
using that propArticleBody
&ThumbnailSmall
ArticleBody
passes a prop toThumbnailSmall
to vary the styling to suit a 4:5 imageArticleFormMeta
&InputImage
collectionType
prop (mapped from app State) and adetermineCardCriteria
using that prop (likeCard
does) and proves the criteria toInputImage
CollectionDisplay
testing locally
COLLECTIONS_USING_PORTRAIT_TRAILS
Implementation notes
As long as
COLLECTIONS_USING_PORTRAIT_TRAILS
is empty, there should be no noticeable change in behaviour, other than the changes in the error alert including the crop dimensions of the criteria.Using a hard coded string array on the frontend isn't the ideal way for configuring which collections use which crop type. It should be okay whilst this feature is experimental/in development.
The extra validation on drag and drop will be happening, but should:
Checklist
General
Client
Collection ("Reader's Tips") with Portrait crops:
Cards with portrait thumbnails: