Skip to content

Commit

Permalink
Handled comments related to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
allroundexperts committed Jun 3, 2022
1 parent 268d43a commit 88bd693
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/ThumbnailImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ class ThumbnailImage extends PureComponent {
* @param {Number} height - Height of the original image.
* @returns {Object} - Object containing thumbnails width and height.
*/

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

// Width of the thumbnail works better as a constant than it does
// a percentage of the screen width since it is relative to each screen
Expand All @@ -75,6 +76,12 @@ class ThumbnailImage extends PureComponent {
return {thumbnailWidth: thumbnailScreenWidth, thumbnailHeight: Math.max(40, thumbnailScreenHeight)};
}

/**
* Update the state with the computed thumbnail sizes.
*
* @param {{ width: number, height: number }} Params - width and height of the original image.
* @returns {void}
*/
updateImageSize({width, height}) {
const {thumbnailWidth, thumbnailHeight} = this.calculateThumbnailImageSize(width, height);
this.setState({thumbnailWidth, thumbnailHeight});
Expand Down

0 comments on commit 88bd693

Please sign in to comment.