Files
suwayomi-material-you-webui/src/components/reader/DoublePage.tsx

58 lines
1.4 KiB
TypeScript
Raw Normal View History

/*
* 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 React from 'react';
2021-12-04 10:24:16 +03:30
import { Box, styled } from '@mui/system';
2021-12-04 10:24:16 +03:30
const Image = styled('img')({
marginBottom: 0,
width: 'auto',
minHeight: '99vh',
height: 'auto',
maxHeight: '99vh',
objectFit: 'contain',
});
interface IProps {
index: number
image1src: string
image2src: string
settings: IReaderSettings
}
const DoublePage = React.forwardRef((props: IProps, ref: any) => {
const {
image1src, image2src, index, settings,
} = props;
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',
}}
>
<Image
src={image1src}
alt={`Page #${index}`}
/>
2021-12-04 10:24:16 +03:30
<Image
src={image2src}
alt={`Page #${index + 1}`}
/>
2021-12-04 10:24:16 +03:30
</Box>
);
});
export default DoublePage;