Skip to content

Commit 80f5102

Browse files
refactor: destructure image metadata parameter
1 parent 0eacfc5 commit 80f5102

File tree

1 file changed

+15
-15
lines changed
  • packages/block-library/src/image

1 file changed

+15
-15
lines changed

packages/block-library/src/image/view.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,36 @@ let isTouching = false;
3131
let lastTouchTime = 0;
3232

3333
/**
34-
* Returns the appropriate src URL for an image
34+
* Returns the appropriate src URL for an image.
3535
*
36-
* @param {Object} imageMetadata Image metadata object
37-
* @return {string} The source URL
36+
* @param {string} uploadedSrc - Full size image src.
37+
* @return {string} The source URL.
3838
*/
39-
function getImageSrc( imageMetadata ) {
39+
function getImageSrc( { uploadedSrc } ) {
4040
return (
41-
imageMetadata.uploadedSrc ||
41+
uploadedSrc ||
4242
'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='
4343
);
4444
}
4545

4646
/**
47-
* Returns the appropriate srcset for an image
47+
* Returns the appropriate srcset for an image.
4848
*
49-
* @param {Object} imageMetadata Image metadata object
50-
* @return {string} The srcset value
49+
* @param {string} lightboxSrcset - Image srcset.
50+
* @return {string} The srcset value.
5151
*/
52-
function getImageSrcset( imageMetadata ) {
53-
return imageMetadata.lightboxSrcset || '';
52+
function getImageSrcset( { lightboxSrcset } ) {
53+
return lightboxSrcset || '';
5454
}
5555

5656
/**
57-
* Returns the appropriate sizes attribute for an image
57+
* Returns the appropriate sizes attribute for an image.
5858
*
59-
* @param {Object} imageMetadata Image metadata object
60-
* @return {string} The sizes value, defaulting to 100vw
59+
* @param {string} lightboxSizes - Image responsive sizes attribute.
60+
* @return {string} The sizes value, defaulting to 100vw.
6161
*/
62-
function getImageSizes( imageMetadata ) {
63-
return imageMetadata.lightboxSizes || '100vw';
62+
function getImageSizes( { lightboxSizes } ) {
63+
return lightboxSizes || '100vw';
6464
}
6565

6666
const { state, actions, callbacks } = store(

0 commit comments

Comments
 (0)