migrate DoublePage to Mui 5 (#88)
This commit is contained in:
@@ -5,28 +5,16 @@
|
|||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
import makeStyles from '@mui/styles/makeStyles';
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { Box, styled } from '@mui/system';
|
||||||
|
|
||||||
const useStyles = (settings: IReaderSettings) => makeStyles({
|
const Image = styled('img')({
|
||||||
image: {
|
marginBottom: 0,
|
||||||
display: 'block',
|
width: 'auto',
|
||||||
marginBottom: 0,
|
minHeight: '99vh',
|
||||||
width: 'auto',
|
height: 'auto',
|
||||||
minHeight: '99vh',
|
maxHeight: '99vh',
|
||||||
height: 'auto',
|
objectFit: 'contain',
|
||||||
maxHeight: '99vh',
|
|
||||||
objectFit: 'contain',
|
|
||||||
},
|
|
||||||
page: {
|
|
||||||
display: 'flex',
|
|
||||||
flexDirection: settings.readerType === 'DoubleLTR' ? 'row' : 'row-reverse',
|
|
||||||
justifyContent: 'center',
|
|
||||||
margin: '0 auto',
|
|
||||||
width: 'auto',
|
|
||||||
height: 'auto',
|
|
||||||
overflowX: 'scroll',
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@@ -41,21 +29,28 @@ const DoublePage = React.forwardRef((props: IProps, ref: any) => {
|
|||||||
image1src, image2src, index, settings,
|
image1src, image2src, index, settings,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const classes = useStyles(settings)();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={ref} className={classes.page}>
|
<Box
|
||||||
<img
|
ref={ref}
|
||||||
className={classes.image}
|
sx={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: settings.readerType === 'DoubleLTR' ? 'row' : 'row-reverse',
|
||||||
|
justifyContent: 'center',
|
||||||
|
margin: '0 auto',
|
||||||
|
width: 'auto',
|
||||||
|
height: 'auto',
|
||||||
|
overflowX: 'scroll',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Image
|
||||||
src={image1src}
|
src={image1src}
|
||||||
alt={`Page #${index}`}
|
alt={`Page #${index}`}
|
||||||
/>
|
/>
|
||||||
<img
|
<Image
|
||||||
className={classes.image}
|
|
||||||
src={image2src}
|
src={image2src}
|
||||||
alt={`Page #${index + 1}`}
|
alt={`Page #${index + 1}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user