Files
suwayomi-material-you-webui/src/modules/reader/components/viewer/pager/ReaderPagedPager.tsx

39 lines
1.3 KiB
TypeScript
Raw Normal View History

2024-11-06 13:00:36 +01:00
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import { BasePager } from '@/modules/reader/components/viewer/pager/BasePager.tsx';
import { ReaderPagerProps } from '@/modules/reader/types/Reader.types.ts';
import { createReaderPage } from '@/modules/reader/utils/ReaderPager.utils.tsx';
export const ReaderPagedPager = ({ onLoad, ...props }: ReaderPagerProps) => {
const { currentPageIndex, totalPages } = props;
return (
<BasePager
{...props}
2024-12-03 18:00:46 +01:00
createPage={(page, pagesIndex, shouldLoad, shouldDisplay) =>
2024-11-06 13:00:36 +01:00
createReaderPage(
page,
() => onLoad?.(pagesIndex),
shouldLoad,
2024-12-03 18:00:46 +01:00
shouldDisplay && currentPageIndex === page.primary.index,
2024-11-06 13:00:36 +01:00
currentPageIndex,
totalPages,
)
}
slots={{
stackProps: {
sx: {
margin: 'auto',
},
},
}}
/>
);
};