2021-05-28 05:36:55 -07: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
|
2023-05-18 13:17:41 +02:00
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
2021-05-28 05:36:55 -07:00
|
|
|
|
2023-08-14 21:43:06 +02:00
|
|
|
import { forwardRef } from 'react';
|
2023-06-04 21:08:39 +02:00
|
|
|
import { Box, styled } from '@mui/material';
|
2023-06-05 01:42:39 +02:00
|
|
|
import { IReaderSettings } from '@/typings';
|
2021-05-28 05:36:55 -07:00
|
|
|
|
2021-12-04 10:24:16 +03:30
|
|
|
const Image = styled('img')({
|
|
|
|
|
marginBottom: 0,
|
|
|
|
|
width: 'auto',
|
|
|
|
|
minHeight: '99vh',
|
|
|
|
|
height: 'auto',
|
|
|
|
|
maxHeight: '99vh',
|
|
|
|
|
objectFit: 'contain',
|
2021-05-28 05:36:55 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
interface IProps {
|
2023-02-06 10:06:33 +01:00
|
|
|
index: number;
|
|
|
|
|
image1src: string;
|
|
|
|
|
image2src: string;
|
|
|
|
|
settings: IReaderSettings;
|
2021-05-28 05:36:55 -07:00
|
|
|
}
|
|
|
|
|
|
2023-08-14 21:43:06 +02:00
|
|
|
const DoublePage = forwardRef((props: IProps, ref: any) => {
|
2023-02-06 10:06:33 +01:00
|
|
|
const { image1src, image2src, index, settings } = props;
|
2021-05-28 05:36:55 -07:00
|
|
|
|
|
|
|
|
return (
|
2021-12-04 10:24:16 +03:30
|
|
|
<Box
|
|
|
|
|
ref={ref}
|
|
|
|
|
sx={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: settings.readerType === 'DoubleLTR' ? 'row' : 'row-reverse',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
margin: '0 auto',
|
|
|
|
|
width: 'auto',
|
|
|
|
|
height: 'auto',
|
|
|
|
|
overflowX: 'scroll',
|
|
|
|
|
}}
|
|
|
|
|
>
|
2023-02-06 10:06:33 +01:00
|
|
|
<Image src={image1src} alt={`Page #${index}`} />
|
|
|
|
|
<Image src={image2src} alt={`Page #${index + 1}`} />
|
2021-12-04 10:24:16 +03:30
|
|
|
</Box>
|
2021-05-28 05:36:55 -07:00
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default DoublePage;
|