diff --git a/src/desktop/components/gallery-modal/components/__test__/gallery-modal.test.tsx b/src/desktop/components/gallery-modal/components/__test__/gallery-modal.test.tsx index 20a9db0..a0c7c36 100644 --- a/src/desktop/components/gallery-modal/components/__test__/gallery-modal.test.tsx +++ b/src/desktop/components/gallery-modal/components/__test__/gallery-modal.test.tsx @@ -117,4 +117,16 @@ describe('GalleryModal', () => { expect(container).toMatchSnapshot(); }); + + it('Должен отключать скролл когда withScrollDisable = true', () => { + render(); + + expect(document.body.style.overflow).toBe('hidden'); + }); + + it('Не должен отключать скролл когда withScrollDisable = false', () => { + render(); + + expect(document.body.style.overflow).not.toBe('hidden'); + }); }); diff --git a/src/desktop/components/gallery-modal/components/gallery-modal.tsx b/src/desktop/components/gallery-modal/components/gallery-modal.tsx index 835668b..293ff5b 100644 --- a/src/desktop/components/gallery-modal/components/gallery-modal.tsx +++ b/src/desktop/components/gallery-modal/components/gallery-modal.tsx @@ -35,6 +35,9 @@ export interface GalleryModalProps { /** Будет вызвана при событиях проигрывания видео. */ onVideoEvent?: (event: SyntheticEvent) => void; + + /** Нужно ли выключать прокрутку body. */ + withScrollDisable?: boolean; } interface InnerStyles extends CSSProperties { @@ -53,6 +56,7 @@ export const GalleryModal = ({ media, defaultMediaIndex = 0, review, + withScrollDisable = false, onClose, onGoToReview, onMediaChange, @@ -86,7 +90,7 @@ export const GalleryModal = ({ return ( - +