-
Notifications
You must be signed in to change notification settings - Fork 22
Integrate srcSet #693
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
Integrate srcSet #693
Conversation
Integrate srcSet
Able to get srcSet working
change to use x instead of w
adjust sizings
clean up
Able to get the homepage to use srcSet
Able to get pdp to work with new image container
able to get appheader working
able to get image container working in productlistitem
uncomment all usages of image container
add styling
update ep.config.json
update mandatory alt tag for img element
More updates to alt element. Include better descriptions for imaeg parameters
fix readme and make more descriptive parameter names
update config file
update README example
Please address conflicts & rebase |
src/ep.config.json
Outdated
@@ -27,12 +25,12 @@ | |||
} | |||
], | |||
"defaultCurrencyValue": "CAD", | |||
"skuImagesUrl": "https://elasticpath-demo-images.s3-us-west-2.amazonaws.com/VESTRI_VIRTUAL_V1/%sku%.png", | |||
"siteImagesUrl": "https://elasticpath-demo-images.s3-us-west-2.amazonaws.com/VESTRI_VIRTUAL_V1/%fileName%", | |||
"skuImagesUrl": "https://refstoreimgs.s3-us-west-2.amazonaws.com/productImages/%fileName%", |
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.
Is this a copy of the existing bucket's images?
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.
Yes its a copy of existing buckets. resized and re-typed versions of the breville catalog within the reference store aws
src/ep.config.json
Outdated
"skuImagesUrl": "https://elasticpath-demo-images.s3-us-west-2.amazonaws.com/VESTRI_VIRTUAL_V1/%sku%.png", | ||
"siteImagesUrl": "https://elasticpath-demo-images.s3-us-west-2.amazonaws.com/VESTRI_VIRTUAL_V1/%fileName%", | ||
"skuImagesUrl": "https://refstoreimgs.s3-us-west-2.amazonaws.com/productImages/%fileName%", | ||
"siteImagesUrl": "https://refstoreimgs.s3-us-west-2.amazonaws.com/siteImages/%fileName%", |
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.
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.
Updated the url
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.
FYI I get cors issues even when switching back to elasticpath-demo-images
imgClassName="category-item-thumbnail img-responsive" | ||
isSkuImage | ||
fileName={productData._code[0].code} | ||
imageFileTypes={['webp', 'jp2', 'jpg']} |
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.
Can we take the "imageFileTypes" from ep.config.json? We're duplicating this across components but it's a shared config and could be changed by an implementor.
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.
I would +1 this!
Would it be possible to make the imageFileTypes
property optional, and have it override whatever is in ep.config.json
?
Most Demo Team assets are PNGs. As this stands right now, we're going to need to not only convert our existing assets to one of the above formats, but also create duplicates (in each of the three formats) for every demo we put out (or go through and manually update the types on each of these components). It would definitely reduce friction if we could configure this in one place, and override manually where necessary.
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.
^ Overriding it per usage sounds like a good idea to me! I'll make those changes :)
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.
Thanks!
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.
updated
Remove image type input
imgClassName="thumbnail" | ||
isSkuImage | ||
fileName={code} | ||
imageFileTypes={['webp', 'jp2', 'jpg']} |
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.
Would it be worth pulling this out before merging this in, and letting the details in ep.config.json determine the types used here?
Also, same question about the following files:
- src/components/src/QuickOrderForm/quickorderform.tsx
- src/components/src/ProductListItem/productlistitem.main.tsx
- src/components/src/ProductDisplayItem/productdisplayitem.main.tsx
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.
Yep removing these types. Will be an optional parameter that will override the types in the config.
isSkuImage: false, | ||
ImageContainerSrcs: [], |
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.
I don't see this defined in the props interface. Where is it used? If you want to keep it it should be camel case like all the prop names.
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.
good catch. Removing
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.
Please address conflicts & rebase
rebased
@@ -0,0 +1,3 @@ | |||
picture { | |||
width: 100%; | |||
} |
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.
good catch!
); | ||
const generateSrcSet = type => imageSizes.reduce((acc, imageSize) => { | ||
if (acc === '') { | ||
return `${acc}${imgPrefix.replace('%fileName%', `${type}/${fileName}-${imageSize}w.${type} ${imageSize}w`)}`; |
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.
WIP looking into it
isSkuImage: false, | ||
ImageContainerSrcs: [], |
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.
good catch. Removing
All problems have been addressed here! This should be ready to be merged! Working on re-skinning docs now :) |
make some quick fixes
@@ -147,8 +147,14 @@ class ProductListItemMain extends Component<ProductListItemMainProps, ProductLis | |||
return ( | |||
<div className="category-item-inner"> | |||
<div className={`category-item-thumbnail-container ${imageStatus === 'loaded' ? 'loaded' : ''}`}> | |||
<Link to={`${itemDetailLink}/${encodeURIComponent(productData._code[0].code)}`} title={productData._definition[0]['display-name']}> |
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.
axe reports an error due to the missing title. I'll fix this in my PR with the version update before release cut-off:
#712
Description:
https://elasticpath.atlassian.net/secure/RapidBoard.jspa?rapidView=467&projectKey=RS&modal=detail&selectedIssue=RS-805&assignee=557058%3A2cdf4e37-eb83-44ee-9d76-d5409db1e998
The purpose of this PR is to implement dynamic images that will fetch the appropriate asset based on window width and browser compatibility. This PR will stop lighthouse from complaining about using next-gen formats and improper sizing for our images. lighthouse performance sees modest improvements and we are hitting the mid to high 50's.
ImageContainer component has been updated to utilize dynamic images enabled through the picture element. Take a look at the component README for more information.
Image assets for the Breville catalog have been sized appropriately for 3 sizing breakpoints:
0-768, 768 - 1092, 1092 - Infinity
. Each sizing containing jpg, jp2, and webp formats which will cover a full range of browsers. The assets can be seen at this s3 bucket: https://s3.console.aws.amazon.com/s3/buckets/refstoreimgs/?region=us-west-2&tab=overview.The demo-team will need to be notified of these assets changes as they are currently using pngs for their demo's.
A seperate project here for image processing:
https://github.com/aChanEP/nextGenImageCreation. We may want to use this as a starting point for a future asset pipeline if we deem it necessary.
// Processed images for bellevie dataset
"skuImagesUrl": "https://ep-demo-assets.s3-us-west-2.amazonaws.com/BELLEVIE/skuImages/%fileName%",
"siteImagesUrl": "https://ep-demo-assets.s3-us-west-2.amazonaws.com/BELLEVIE/siteImages/%fileName%",
TODO's:
Linting:
Tests:
e2e
)Documentation: