migrate PagedPager to Mui 5 (#93)

This commit is contained in:
Aria Moradi
2021-12-03 10:36:36 +03:30
committed by GitHub
parent 1a62bad4a6
commit 890e0c8aa3

View File

@@ -5,28 +5,15 @@
* 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 makeStyles from '@mui/styles/makeStyles';
import React, { useEffect, useRef } from 'react';
import { Box } from '@mui/system';
import Page from '../Page';
const useStyles = makeStyles({
reader: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
margin: '0 auto',
width: '100%',
height: '100vh',
},
});
export default function PagedReader(props: IReaderProps) {
const {
pages, settings, setCurPage, curPage, nextChapter, prevChapter,
} = props;
const classes = useStyles();
const selfRef = useRef<HTMLDivElement>(null);
function nextPage() {
@@ -97,7 +84,17 @@ export default function PagedReader(props: IReaderProps) {
}, [selfRef, curPage, settings.readerType]);
return (
<div ref={selfRef} className={classes.reader}>
<Box
ref={selfRef}
sx={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
margin: '0 auto',
width: '100%',
height: '100vh',
}}
>
<Page
key={curPage}
index={curPage}
@@ -106,6 +103,6 @@ export default function PagedReader(props: IReaderProps) {
setCurPage={setCurPage}
settings={settings}
/>
</div>
</Box>
);
}