Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions types/fslightbox-react/fslightbox-react-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import FsLightbox from "fslightbox-react";
import * as React from "react";

class Test extends React.Component {
handleEvent = (instance: FsLightbox) => {};
handleEvent = (instance: any) => {};
handleSourceLoadEvent = (instance: any, source: any, index: number) => {};

render() {
return (
Expand All @@ -24,6 +25,11 @@ class Test extends React.Component {
type="image"
types={[null, "video", "youtube"]}
thumbs={[null, "yt.jpg", "bbbunny.jpg", "vimeo.jpg"]}
thumbsIcon={
<svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="00 430.118 430.118">
<path d="M0 0 H119.054 V119.054 H0 V0 z M158.946 0 H278 V119.054 H158.946 V0 z M158.946 158.946 H278 V278 H158.946 V158.946 z M0 158.946 H119.054 V278 H0 V158.946 z" />
</svg>
}
thumbsIcons={[
null,
<svg xmlns="http://www.w3.org/2000/svg" width="28px" height="28px" viewBox="00 430.118 430.118">
Expand All @@ -39,6 +45,7 @@ class Test extends React.Component {
captions={[<h2>Caption 1</h2>, "Caption 2", "Caption 3"]}
customAttributes={[null, { poster: "bbbunny.jpg" }]}
showThumbsOnMount={false}
showThumbsWithCaptions={true}
disableThumbs={false}
openOnMount={false}
autoplay
Expand All @@ -48,34 +55,35 @@ class Test extends React.Component {
exitFullscreenOnClose={false}
slideDistance={0.5}
slideshowTime={10000}
sourceMargin={0.2}
UIFadeOutTime={10000}
zoomIncrement={0.5}
onInit={this.handleEvent}
onOpen={this.handleEvent}
onShow={this.handleEvent}
onClose={this.handleEvent}
onSourceLoad={this.handleSourceLoadEvent}
onSlideChange={this.handleEvent}
maxYoutubeVideoDimensions={{ width: 400, height: 300 }}
initialAnimation="example-initial-animation"
slideChangeAnimation="example-slide-change-animation"
svg={{
toolbarButtons: {
thumbs: {
class: "new-thumbs-btn",
viewBox: "0 0 278 278",
width: "17px",
height: "17px",
d: "M0 0 H119.054 V119.054 H0 V0 z M158.946 0 H278 V119.054 H158.946 V0 z M158.946 158.946 H278 V278 H158.946 V158.946 z M0 158.946 H119.054 V278 H0 V158.946 z",
title: "Preview",
},
zoomIn: {
width: "20px",
title: "Bigger",
},
zoomOut: {
height: "20px",
class: "new-zoom-out",
},
slideshow: {
start: {
width: "20px",
d: "M 1",
},
pause: {
viewBox: "0 0 31 31",
Expand All @@ -90,12 +98,12 @@ class Test extends React.Component {
},
},
close: {
height: "32px",
d: "M 0",
},
},
slideButtons: {
previous: {
width: "40px",
viewBox: "0 0 40 40",
},
next: {
title: "Next",
Expand Down
21 changes: 11 additions & 10 deletions types/fslightbox-react/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ declare namespace FsLightbox {
}

interface ToolbarButtonProps {
class?: string;
viewBox?: string;
d?: string;
width?: string;
height?: string;
title?: string;
}

Expand All @@ -32,15 +31,15 @@ declare namespace FsLightbox {

// slide number controlling
slide?: number | undefined;
source?: string | undefined;
sourceIndex?: number | undefined;

// events
onOpen?: ((instance: FsLightbox) => void) | undefined;
onClose?: ((instance: FsLightbox) => void) | undefined;
onInit?: ((instance: FsLightbox) => void) | undefined;
onShow?: ((instance: FsLightbox) => void) | undefined;
onSlideChange?: ((instance: FsLightbox) => void) | undefined; // pro feature
onOpen?: ((instance: any) => void) | undefined;
onClose?: ((instance: any) => void) | undefined;
onInit?: ((instance: any) => void) | undefined;
onShow?: ((instance: any) => void) | undefined;
onSourceLoad?: ((instance: any, source: any, index: number) => void) | undefined;
onSlideChange?: ((instance: any) => void) | undefined; // pro feature

// types
disableLocalStorage?: boolean | undefined;
Expand All @@ -53,6 +52,7 @@ declare namespace FsLightbox {

// thumbs
thumbs?: Array<string | null> | undefined; // pro feature
thumbsIcon?: React.JSX.Element | undefined; // pro feature
thumbsIcons?: Array<React.JSX.Element | null> | undefined; // pro feature

// animations
Expand All @@ -66,9 +66,11 @@ declare namespace FsLightbox {
disableSlideSwiping?: boolean | undefined;
loadOnlyCurrentSource?: boolean | undefined;
showThumbsOnMount?: boolean | undefined; // pro feature
showThumbsWithCaptions?: boolean | undefined; // pro feature
disableThumbs?: boolean | undefined; // pro feature
slideDistance?: number | undefined;
slideshowTime?: number | undefined; // pro feature
sourceMargin?: number | undefined;
UIFadeOutTime?: number | false | undefined; // pro feature
zoomIncrement?: number | undefined; // pro feature
openOnMount?: boolean | undefined;
Expand Down Expand Up @@ -98,6 +100,5 @@ declare namespace FsLightbox {
}
}

declare class FsLightbox extends React.Component<FsLightbox.FsLightboxProps> {}

declare const FsLightbox: React.FC<FsLightbox.FsLightboxProps>;
export = FsLightbox;
2 changes: 1 addition & 1 deletion types/fslightbox-react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/fslightbox-react",
"version": "1.8.9999",
"version": "2.0.9999",
"projects": [
"https://fslightbox.com/"
],
Expand Down