Show correct image in lightbox (#5659)

This commit is contained in:
WithoutPants
2025-02-18 16:32:13 +11:00
committed by GitHub
parent 638398808b
commit 50a900e83c
4 changed files with 13 additions and 13 deletions

View File

@@ -4,7 +4,7 @@ import { IState, useLightboxContext } from "./context";
import { IChapter } from "./types";
export const useLightbox = (
state: Partial<Omit<IState, "isVisible">>,
state: Partial<Omit<IState, "isVisible">> = {},
chapters: IChapter[] = []
) => {
const { setLightboxState } = useLightboxContext();
@@ -33,14 +33,13 @@ export const useLightbox = (
]);
const show = useCallback(
(index?: number, slideshowEnabled = false) => {
(props: Partial<IState>) => {
setLightboxState({
initialIndex: index,
...props,
isVisible: true,
slideshowEnabled,
page: state.page,
pages: state.pages,
pageSize: state.pageSize,
page: props.page ?? state.page,
pages: props.pages ?? state.pages,
pageSize: props.pageSize ?? state.pageSize,
chapters: chapters,
});
},