Skip to content

Commit

Permalink
PLANET-7446: Remove lightbox (#1259)
Browse files Browse the repository at this point in the history
PLANET-7446: Force no lightbox

- Remove lightbox from paragraphs by class name
  • Loading branch information
mardelnet authored Oct 31, 2024
1 parent 35690d9 commit 7f2c48b
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 1,044 deletions.
30 changes: 3 additions & 27 deletions assets/src/blocks/Gallery/GalleryFrontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,15 @@ import {GalleryCarousel} from './GalleryCarousel';
import {GalleryThreeColumns} from './GalleryThreeColumns';
import {GalleryGrid} from './GalleryGrid';
import {getGalleryLayout, GALLERY_BLOCK_CLASSES} from './getGalleryLayout';
import {getCaptionWithCredits} from './getCaptionWithCredits.js';
import {Lightbox} from '../../components/Lightbox/Lightbox';
import {useLightbox} from '../../components/Lightbox/useLightbox';

const imagesToItems = images => images.map(
image => ({
src: image.image_src,
w: 0,
h: 0,
title: getCaptionWithCredits(image),
})
);

export const GalleryFrontend = ({
attributes = {},
renderLightbox = false,
}) => {
const [images, setImages] = useState([]);
const [items, setItems] = useState([]);
const {isOpen, index, openLightbox, closeLightbox} = useLightbox();
const className = attributes.className ?? '';
const layout = getGalleryLayout(className, attributes.gallery_block_style ?? '');
const postType = document.body.getAttribute('data-post-type');

useEffect(() => {
setItems(imagesToItems(images));
}, [images]);

useEffect(() => {
if (attributes.image_data.length && attributes.images.length) {
setImages(attributes.images);
Expand All @@ -54,16 +35,11 @@ export const GalleryFrontend = ({

{images.length ? (
<>
{layout === 'slider' && <GalleryCarousel onImageClick={openLightbox} images={images} />}
{layout === 'three-columns' && <GalleryThreeColumns onImageClick={openLightbox} images={images} postType={postType} />}
{layout === 'grid' && <GalleryGrid onImageClick={openLightbox} images={images} />}
{layout === 'slider' && <GalleryCarousel images={images} />}
{layout === 'three-columns' && <GalleryThreeColumns images={images} postType={postType} />}
{layout === 'grid' && <GalleryGrid images={images} />}
</>
) : null}

{(renderLightbox && items.length) ?
<Lightbox isOpen={isOpen} index={index} items={items} onClose={closeLightbox} /> :
null
}
</section>
);
};
118 changes: 0 additions & 118 deletions assets/src/components/Lightbox/Lightbox.js

This file was deleted.

54 changes: 0 additions & 54 deletions assets/src/components/Lightbox/setupLightboxForImages.js

This file was deleted.

18 changes: 0 additions & 18 deletions assets/src/components/Lightbox/useLightbox.js

This file was deleted.

3 changes: 0 additions & 3 deletions assets/src/frontendIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'regenerator-runtime/runtime';

import {HappypointFrontend} from './blocks/Happypoint/HappypointFrontend';
import {ColumnsFrontend} from './blocks/Columns/ColumnsFrontend';
import {setupLightboxForImages} from './components/Lightbox/setupLightboxForImages';
import {setupParallax} from './components/Parallax/setupParallax';

import {createRoot} from 'react-dom/client';
Expand Down Expand Up @@ -33,7 +32,5 @@ document.addEventListener('DOMContentLoaded', () => {
rootElement.render(<BlockFrontend {...attributes.attributes} />);
}
);

setupLightboxForImages();
setupParallax();
});
1 change: 0 additions & 1 deletion assets/src/styles/lightbox.scss

This file was deleted.

19 changes: 0 additions & 19 deletions assets/src/styles/vendors/photoswipe/_main-settings.scss

This file was deleted.

Loading

0 comments on commit 7f2c48b

Please sign in to comment.