Skip to content

Commit

Permalink
fix: handled pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed May 20, 2022
1 parent d004c21 commit e8ad005
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/ThumbnailImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ class ThumbnailImage extends PureComponent {
};
}

/**
* Compute the thumbnails width and height given original image dimensions.
*
* @param {Number} width - Width of the original image.
* @param {Number} height - Height of the original image.
* @returns {Object} - Object containing thumbnails width and height.
*/

calculateThumbnailImageSize(width, height) {
if (!width || !height) { return {}; }

Expand All @@ -66,8 +74,8 @@ class ThumbnailImage extends PureComponent {
}

updateImageSize({width, height}) {
const {width: thumbnailScreenWidth, height: thumbnailScreenHeight} = this.calculateThumbnailImageSize(width, height);
this.setState({thumbnailWidth: thumbnailScreenWidth, thumbnailHeight: Math.max(40, thumbnailScreenHeight)});
const {width: thumbnailWidth, height: thumbnailScreenHeight} = this.calculateThumbnailImageSize(width, height);
this.setState({thumbnailWidth, thumbnailHeight: Math.max(40, thumbnailScreenHeight)});
}

render() {
Expand Down

0 comments on commit e8ad005

Please sign in to comment.