Skip to content

Commit

Permalink
fix: change lightBoxAdditionalProps
Browse files Browse the repository at this point in the history
* fix: change lightBoxAdditionalProps

* fix: readme

* fix: readme

* fix: readme

Co-authored-by: Ori Amir <[email protected]>
  • Loading branch information
OriAmir and Ori Amir authored Aug 14, 2022
1 parent e235b1c commit 3aa4ae5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,17 @@ You can control the selected images yourself in your component or just get the i

:warning: If you will not pass the image <b>id</b> property to the image element the selected image will return as URL representation instead of id representation. In the case of a duplicate image URL, this feature will not work as expected.
<br/>
:warning: When passing the `onSelect` function to the library it's automatically move to <b>Uncontrolled</b> mode and will not manage the selected images any more.
:warning: When passing the `onSelect` function to the library it's automatically move to <b>Uncontrolled</b> mode and will not manage the selected images any more.<br/>


<br/>
<h3>Using Lightbox</h3>
You can use lightbox when clicking on one of the images that display on the gallery.
For the lightbox component library we use the <a target="_blank" href="https://www.npmjs.com/package/react-image-lightbox">react-image-lightbox library</a>.<br/>
You can sent the props from this library and to send them as prop to library called <b>'lightBoxAdditionalProps'</b>.
If you want to pass image caption and title you can pass that via the img props.
You can sent the props from this library and to send them as prop to library called <b>'lightBoxAdditionalProps'</b>.</br>

:warning: These properties are not available to send as additional props (because we already using them internally):
`mainSrc, nextSrc, prevSrc, onCloseRequest, onMovePrevRequest, onMoveNextRequest` <br/>
:warning: If you want to pass `imageTitle` or `imageCaption` you can pass that via the img props.

<br/><br/>

Expand All @@ -175,5 +176,4 @@ For bugs, questions and discussions please use the <a href="https://github.com/O

<br/>
<h3>License</h4>
React Responsive Gallery is free to use for personal and commercial projects under the MIT License.
```
React Responsive Gallery is free to use for personal and commercial projects under the MIT License.
15 changes: 11 additions & 4 deletions src/components/Gallery/Gallery.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ export interface ImageElementProps {
orderL?: number;
}

interface AdditionalILightBoxProps extends Omit<ILightBoxProps, "mainSrc" | "onCloseRequest"> {
mainSrc?: string;
onCloseRequest?(): void;
}
export type AdditionalILightBoxProps = Omit<
ILightBoxProps,
| "mainSrc"
| "nextSrc"
| "prevSrc"
| "onCloseRequest"
| "onMovePrevRequest"
| "onMoveNextRequest"
| "imageTitle"
| "imageCaption"
>;

export type ResponsiveGalleryProps = {
images: Array<ImageElementProps>;
Expand Down
8 changes: 5 additions & 3 deletions src/components/Gallery/ImagesLightBox/ImagesLightBox.types.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ILightBoxProps } from "react-image-lightbox";
import { ImageElementProps } from "../../Gallery/Gallery.types";
import {
ImageElementProps,
AdditionalILightBoxProps,
} from "../../Gallery/Gallery.types";

export type ImageLightBoxProps = {
imagesLightbox: Array<ImageElementProps>;
photoIndex: number;
lightBoxDispatch: (obj: { type: string; payload?: number | string }) => void;
lightBoxAdditionalProps?: ILightBoxProps;
lightBoxAdditionalProps?: AdditionalILightBoxProps;
};

0 comments on commit 3aa4ae5

Please sign in to comment.