From 2b61eb28d4c2e63bba6104921f7850cac2d11bd4 Mon Sep 17 00:00:00 2001 From: Nick Schubach Date: Wed, 18 Oct 2023 11:14:49 -0400 Subject: [PATCH] Type fixes --- src/components/Gallery/index.test.tsx | 180 ++++++++++----------- src/components/Gallery/index.tsx | 15 +- src/components/Lightbox/lightbox-react.tsx | 33 ++-- src/utils/Version.tsx | 2 +- 4 files changed, 113 insertions(+), 117 deletions(-) diff --git a/src/components/Gallery/index.test.tsx b/src/components/Gallery/index.test.tsx index a4c182c1..55fd2701 100644 --- a/src/components/Gallery/index.test.tsx +++ b/src/components/Gallery/index.test.tsx @@ -158,7 +158,7 @@ function sleep(ms: number): Promise { return new Promise((resolve: Function) => setTimeout(resolve, ms)); } -function createClientXY(x: number, y: number, target: EventTarget): Touch { +function createClientXY(x: number, y: number, target: EventTarget) { return { clientX: x, clientY: y, @@ -199,7 +199,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(0) .childAt(0) - .name() + .name(), ).toBe("FullscreenIcon"); expect( wrapper @@ -207,7 +207,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(0) .childAt(0) - .prop("fill") + .prop("fill"), ).toBe("#6B6B6B"); expect( wrapper @@ -215,7 +215,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(0) .childAt(1) - .name() + .name(), ).toBe("styled__PlaybackText"); expect( wrapper @@ -223,13 +223,13 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(0) .childAt(1) - .text() + .text(), ).toBe("Expand"); }); it("must emit events when enter/exit full screen mode", async () => { const wrapper = mount( - + , ); const fullScreenBtnWrapper = wrapper.find("styled__ControlContainer").find("button").at(0); const ran: string[] = []; @@ -241,10 +241,10 @@ describe("the gallery block", () => { }; EventEmitter.subscribe("galleryExpandEnter", (event: GalleryEventData) => - eventHandler(event, "start") + eventHandler(event, "start"), ); EventEmitter.subscribe("galleryExpandExit", (event: GalleryEventData) => - eventHandler(event, "stop") + eventHandler(event, "stop"), ); fullScreenBtnWrapper.simulate("click"); await sleep(500); @@ -267,7 +267,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(1) .childAt(0) - .name() + .name(), ).toBe("PlayIcon"); expect( wrapper @@ -275,7 +275,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(1) .childAt(0) - .prop("fill") + .prop("fill"), ).toBe("#6B6B6B"); expect( wrapper @@ -283,7 +283,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(1) .childAt(1) - .name() + .name(), ).toBe("styled__PlaybackText"); expect( wrapper @@ -291,7 +291,7 @@ describe("the gallery block", () => { .find("styled__ControlsButton") .at(1) .childAt(1) - .text() + .text(), ).toBe("Autoplay"); }); @@ -332,7 +332,7 @@ describe("the gallery block", () => { resizerURL="" ansId={ansId} ansHeadline={ansHeadline} - /> + />, ); const autoBtnWrapper = wrapper.find("styled__ControlContainer").find("button").at(1); const ran: number[] = []; @@ -349,10 +349,10 @@ describe("the gallery block", () => { }; EventEmitter.subscribe("galleryAutoplayStart", (event: GalleryEventData) => - eventHandler(event, 1) + eventHandler(event, 1), ); EventEmitter.subscribe("galleryAutoplayStop", (event: GalleryEventData) => - eventHandler(event, 2) + eventHandler(event, 2), ); autoBtnWrapper.simulate("click"); autoBtnWrapper.simulate("click"); @@ -363,7 +363,7 @@ describe("the gallery block", () => { it("must stop and the end of the gallery and generate the events", () => { const wrapper = mount( - + , ); const autoBtnWrapper = wrapper.find("styled__ControlContainer").find("button").at(1); const ran: number[] = []; @@ -376,10 +376,10 @@ describe("the gallery block", () => { }; EventEmitter.subscribe("galleryAutoplayStart", (event: GalleryEventData) => - eventHandler(event, 1) + eventHandler(event, 1), ); EventEmitter.subscribe("galleryAutoplayStop", (event: GalleryEventData) => - eventHandler(event, 2) + eventHandler(event, 2), ); autoBtnWrapper.simulate("click"); sleep(5000).then(() => { @@ -448,7 +448,7 @@ describe("the gallery block", () => { it("should have aria label and roledescription on container", () => { const ansHeadlineText = "Headline Text"; const wrapper = shallow( - + , ); expect(wrapper.at(0).prop("aria-label")).toBe(ansHeadlineText); @@ -459,10 +459,10 @@ describe("the gallery block", () => { const wrapper = shallow(); const imagesWrapper = wrapper.find(".image-wrapper"); expect( - imagesWrapper.everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)") + imagesWrapper.everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)"), ).toBe(true); expect( - imagesWrapper.everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + imagesWrapper.everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); }); @@ -477,17 +477,17 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); }); expect(wrapper.find("styled__ImageCountText").text()).toMatch("2 of 6"); @@ -503,24 +503,24 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find(".image-wrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(calc(0% - 50px), 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(calc(0% - 50px), 0)"), ).toBe(true); expect( wrapper .find(".image-wrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "0s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "0s"), ).toBe(true); }); @@ -534,29 +534,29 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find(".image-wrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(-100%, 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(-100%, 0)"), ).toBe(true); expect( wrapper .find(".image-wrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); }); }); @@ -572,17 +572,17 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 10 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 10 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 10 }, carouselNode)), ); }); expect(wrapper.find("styled__ImageCountText").text()).toMatch("2 of 6"); @@ -590,17 +590,17 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)), ); }); expect(wrapper.find("styled__ImageCountText").text()).toMatch("1 of 6"); @@ -616,27 +616,27 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); }); wrapper.update(); @@ -644,13 +644,13 @@ describe("the gallery block", () => { wrapper .find("styled__ImageWrapper") .everyWhere( - (wrap) => wrap.prop("style").transform === "translate(calc(-100% - -40px), 0)" - ) + (wrap) => wrap.prop("style").transform === "translate(calc(-100% - -40px), 0)", + ), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "0s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "0s"), ).toBe(true); }); @@ -664,57 +664,57 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(-100%, 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(-100%, 0)"), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); act(() => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)"), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); }); }); @@ -732,29 +732,29 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transform === `translate(${i * -100}%, 0)`) + .everyWhere((wrap) => wrap.prop("style").transform === `translate(${i * -100}%, 0)`), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); expect(wrapper.find("styled__ImageCountText").text()).toMatch(`${i + 1} of 6`); } @@ -763,29 +763,29 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 100, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 10, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(-500%, 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(-500%, 0)"), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); expect(wrapper.find("styled__ImageCountText").text()).toMatch("6 of 6"); }); @@ -802,29 +802,29 @@ describe("the gallery block", () => { carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)) + new TouchEvent("touchstart", createTouchEvent({ x: 10, y: 10 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)) + new TouchEvent("touchmove", createTouchEvent({ x: 50, y: 20 }, carouselNode)), ); carouselWrapper .getDOMNode() .dispatchEvent( - new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)) + new TouchEvent("touchend", createTouchEvent({ x: 100, y: 30 }, carouselNode)), ); }); wrapper.update(); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)") + .everyWhere((wrap) => wrap.prop("style").transform === "translate(0%, 0)"), ).toBe(true); expect( wrapper .find("styled__ImageWrapper") - .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s") + .everyWhere((wrap) => wrap.prop("style").transitionDuration === "1s"), ).toBe(true); expect(wrapper.find("styled__ImageCountText").text()).toMatch("1 of 6"); }); @@ -855,7 +855,7 @@ describe("the gallery block", () => { const wrapper = shallow(); wrapper.find("styled__ImageWrapper").forEach((imageWrapper, index) => { expect(imageWrapper.find("Image").first().prop("url")).toStrictEqual( - mockGallery[index].url + mockGallery[index].url, ); }); }); @@ -864,7 +864,7 @@ describe("the gallery block", () => { const wrapper = shallow(); wrapper.find("styled__ImageWrapper").forEach((imageWrapper, index) => { expect(imageWrapper.find("Image").first().prop("alt")).toStrictEqual( - mockGallery[index].alt_text + mockGallery[index].alt_text, ); }); }); @@ -919,7 +919,7 @@ describe("the gallery block", () => { it("should set the phrase text to the passed in string", () => { const wrapper = mount(); expect( - wrapper.find("styled__ControlsButton").at(0).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(0).find("styled__PlaybackText").text(), ).toEqual("Förstora"); }); }); @@ -928,7 +928,7 @@ describe("the gallery block", () => { it("should set the phrase text to the default string", () => { const wrapper = mount(); expect( - wrapper.find("styled__ControlsButton").at(0).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(0).find("styled__PlaybackText").text(), ).toEqual("Expand"); }); }); @@ -939,7 +939,7 @@ describe("the gallery block", () => { it("should set the phrase text to the passed in string", () => { const wrapper = mount(); expect( - wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text(), ).toEqual("Spela upp"); }); }); @@ -948,7 +948,7 @@ describe("the gallery block", () => { it("should set the phrase text to the default string", () => { const wrapper = mount(); expect( - wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text(), ).toEqual("Autoplay"); }); }); @@ -961,7 +961,7 @@ describe("the gallery block", () => { const autoButtonWrapper = wrapper.find("styled__ControlContainer").find("button").at(1); autoButtonWrapper.simulate("click"); expect( - wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text(), ).toEqual("Pausa"); }); }); @@ -972,7 +972,7 @@ describe("the gallery block", () => { const autoButtonWrapper = wrapper.find("styled__ControlContainer").find("button").at(1); autoButtonWrapper.simulate("click"); expect( - wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text() + wrapper.find("styled__ControlsButton").at(1).find("styled__PlaybackText").text(), ).toEqual("Pause autoplay"); }); }); @@ -985,7 +985,7 @@ describe("the gallery block", () => { `${current} av ${total}`} - /> + />, ); expect(wrapper.find("styled__ImageCountText").text()).toMatch("1 av 6"); }); @@ -1000,7 +1000,7 @@ describe("the gallery block", () => { }); describe("the interstitialClicks prop", () => { - const AdBlock = (): React.ReactElement => ( + const AdBlock = () => (

AdBlock

@@ -1008,7 +1008,7 @@ describe("the gallery block", () => { it("should render an Ad at 2nd position when interstitialClick match", async () => { const wrapper = mount( - + , ); expect(wrapper.find(".ad-block").length).toBe(0); const fowardButton = wrapper.find("button.next-button").at(0); @@ -1025,7 +1025,7 @@ describe("the gallery block", () => { it("should render an Ad at 1st position when interstitialClick match on any direction", async () => { const wrapper = mount( - + , ); expect(wrapper.find(".ad-block").length).toBe(0); const fowardButton = wrapper.find("button.next-button").at(0); @@ -1047,21 +1047,17 @@ describe("the gallery block", () => { describe("the eagerLoadFirstImage prop", () => { it("sets the first image to load eager when true", () => { - const wrapper = mount( - - ); + const wrapper = mount(); const images = wrapper.find("Image"); expect(images.at(0).prop("loading")).toBe("eager"); expect(images.at(1).prop("loading")).toBe("lazy"); }); - + it("sets the first image to load lazy when false", () => { - const wrapper = mount( - - ); + const wrapper = mount(); const images = wrapper.find("Image"); expect(images.at(0).prop("loading")).toBe("lazy"); expect(images.at(1).prop("loading")).toBe("lazy"); }); - }) + }); }); diff --git a/src/components/Gallery/index.tsx b/src/components/Gallery/index.tsx index e240d3b7..15afe86f 100644 --- a/src/components/Gallery/index.tsx +++ b/src/components/Gallery/index.tsx @@ -88,7 +88,7 @@ interface GalleryProps extends CreditOptions { pausePhrase?: string; pageCountPhrase?: (current: number, total: number) => string; interstitialClicks?: number; - adElement?: Function; + adElement?: any; previousImagePhrase?: string; nextImagePhrase?: string; controlsFont?: string; @@ -151,7 +151,7 @@ const Gallery: React.FC = ({ eventName: string, pg: number, ord: number, - options: EventOptionsInterface = {} + options: EventOptionsInterface = {}, ): void => { EventEmitter.dispatch(eventName, { eventName, @@ -285,7 +285,7 @@ const Gallery: React.FC = ({ lightboxHashString, targetLightboxDimensions, imageSourceWithoutProtocol, - resizerURL + resizerURL, ); return imageSrc; } @@ -317,7 +317,6 @@ const Gallery: React.FC = ({ delta: -event.deltaX, }); }, - preventDefaultTouchmoveEvent: false, }); const renderAd = (): React.ReactElement => { @@ -345,7 +344,7 @@ const Gallery: React.FC = ({ imgContent: GalleryElement, index: number, showAd: boolean, - totalImages: number + totalImages: number, ): React.ReactElement => ( = ({ resizedImageOptions={imgContent.resized_params} breakpoints={imgContent.breakpoints || {}} resizerURL={resizerURL} - loading={eagerLoadFirstImage && index === 0 ? 'eager' : 'lazy'} + loading={eagerLoadFirstImage && index === 0 ? "eager" : "lazy"} /> )} @@ -481,8 +480,8 @@ const Gallery: React.FC = ({ imgContent, index, isAdActive() && isAdInPage(index), - galleryElements.length - ) + galleryElements.length, + ), )} { // Use full-size image if available fitSizes = this.getFitSizes( this.imageCache[imageSrc].width, - this.imageCache[imageSrc].height + this.imageCache[imageSrc].height, ); } else if (this.isImageLoaded(this.props[`${srcType}Thumbnail`])) { // Fall back to using thumbnail if the image has not been loaded @@ -657,7 +658,7 @@ class ReactImageLightbox extends Component { fitSizes = this.getFitSizes( this.imageCache[imageSrc].width, this.imageCache[imageSrc].height, - true + true, ); } else { return null; @@ -1027,7 +1028,7 @@ class ReactImageLightbox extends Component { this.changeZoom( this.state.zoomLevel + ZOOM_BUTTON_INCREMENT_SIZE, event.clientX, - event.clientY + event.clientY, ); } } @@ -1123,7 +1124,7 @@ class ReactImageLightbox extends Component { ReactImageLightbox.isTargetMatchImage(event.target) ) { [].forEach.call(event.changedTouches, (eventTouch) => - this.addPointer(ReactImageLightbox.parseTouchPointer(eventTouch)) + this.addPointer(ReactImageLightbox.parseTouchPointer(eventTouch)), ); this.multiPointerStart(event); } @@ -1134,8 +1135,8 @@ class ReactImageLightbox extends Component { this.multiPointerMove( event, [].map.call(event.changedTouches, (eventTouch) => - ReactImageLightbox.parseTouchPointer(eventTouch) - ) + ReactImageLightbox.parseTouchPointer(eventTouch), + ), ); } } @@ -1143,7 +1144,7 @@ class ReactImageLightbox extends Component { handleTouchEnd(event): void { if (this.shouldHandleEvent(SOURCE_TOUCH)) { [].map.call(event.changedTouches, (touch) => - this.removePointer(ReactImageLightbox.parseTouchPointer(touch)) + this.removePointer(ReactImageLightbox.parseTouchPointer(touch)), ); this.multiPointerEnd(event); } @@ -1645,7 +1646,7 @@ class ReactImageLightbox extends Component { {this.props.imageLoadErrorMessage} - + , ); return; @@ -1671,7 +1672,7 @@ class ReactImageLightbox extends Component { key={this.props[srcType] + keyEndings[srcType]} > {loadingIcon} - + , ); return; @@ -1690,7 +1691,7 @@ class ReactImageLightbox extends Component { key={imageSrc + keyEndings[srcType]} >
- + , ); } else { displayItems.push( @@ -1705,7 +1706,7 @@ class ReactImageLightbox extends Component { key={imageSrc + keyEndings[srcType]} alt={typeof imageTitle === "string" ? imageTitle : translate("Image")} draggable={false} - /> + />, ); } }; @@ -1732,7 +1733,7 @@ class ReactImageLightbox extends Component { draggable={false} > {DisplayItem} - + , ); }; @@ -1757,7 +1758,7 @@ class ReactImageLightbox extends Component { {this.props.imageLoadErrorMessage} - + , ); } else if (typeof targetImage === "string") { // addImage is a helper component that adds an image to displayItems @@ -1818,7 +1819,7 @@ class ReactImageLightbox extends Component { // Focus on the div with key handlers if (this.outerEl) { const lightBoxClose: HTMLElement = this.outerEl.querySelector( - "#lightbox-close" + "#lightbox-close", ) as HTMLElement; lightBoxClose.focus(); } diff --git a/src/utils/Version.tsx b/src/utils/Version.tsx index dfda5c17..d729140b 100644 --- a/src/utils/Version.tsx +++ b/src/utils/Version.tsx @@ -1,6 +1,6 @@ import React from "react"; import pkg from "../../package.json"; -const Version: React.SFC = () =>

{pkg.version}

; +const Version: any = () =>

{pkg.version}

; export default Version;