Skip to content

Commit

Permalink
refactor: Rename showModal to showLightBox
Browse files Browse the repository at this point in the history
  • Loading branch information
oluwatobiss committed Jul 11, 2024
1 parent 2446023 commit 8f99e8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/ImageGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function ImageGallery({
const [imageSrc, setImageSrc] = useState("");
const [slideNumber, setSlideNumber] = useState(1);
const lightboxRef = useRef<HTMLElement>(null);
const showModal = useRef(false);
const showLightBox = useRef(false);

const galleryContainerStyle = imageGalleryStyles(
columnCount,
Expand All @@ -31,7 +31,7 @@ export function ImageGallery({
undefined,
undefined,
undefined,
showModal.current
showLightBox.current
).modalContainerStyle;
const modalSlideNumberStyle = imageGalleryStyles().modalSlideNumberStyle;
const modalToolbarStyle = imageGalleryStyles().modalToolbarStyle;
Expand Down Expand Up @@ -235,12 +235,12 @@ export function ImageGallery({
if (open) {
document.documentElement.style.overflow = "hidden";
lightboxRef.current?.focus();
showModal.current = true;
showLightBox.current = true;
} else {
document.documentElement.style.overflow = "";
document.fullscreenElement &&
document.exitFullscreen().catch((error) => console.error(error));
showModal.current = false;
showLightBox.current = false;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ImageGalleryStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function imageGalleryStyles(
columnCount?: string | number,
columnWidth?: string | number,
gapSize?: number,
showModal?: boolean
showLightBox?: boolean
) {
const galleryContainerStyle: React.CSSProperties = {
columnCount,
Expand Down Expand Up @@ -36,7 +36,7 @@ export function imageGalleryStyles(
const modalContainerStyle: React.CSSProperties = {
outline: "none",
position: "fixed",
display: `${showModal ? "block" : "none"}`,
display: `${showLightBox ? "block" : "none"}`,
zIndex: 7000000000,
top: 0,
left: 0,
Expand Down

0 comments on commit 8f99e8d

Please sign in to comment.