Skip to content

Commit

Permalink
simplify condition
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispader committed Jan 24, 2024
1 parent 33dea64 commit a058e3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/Lightbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ function Lightbox({
};
}, [hasSiblingCarouselItems, contentSize, isCanvasLoading, canvasSize]);

// If the fallback image is currently visible, we want to hide the Lightbox until the fallback gets hidden,
// so that we don't see two overlapping images at the same time.
// If the fallback image is currently visible, we want to hide the Lightbox by setting the opacity to 0,
// until the fallback gets hidden so that we don't see two overlapping images at the same time.
// If there the Lightbox is not used within a carousel, we don't need to hide the Lightbox,
// because it's only going to be rendered after the fallback image is hidden.
const shouldShowLightbox = isLightboxImageLoaded && (!hasSiblingCarouselItems || !isFallbackVisible);
const shouldShowLightbox = isLightboxImageLoaded && !isFallbackVisible;

const isActive = index === activeIndex;
const isFallbackStillLoading = isFallbackVisible && !isFallbackImageLoaded;
Expand Down

0 comments on commit a058e3b

Please sign in to comment.