migrate PagedPager to Mui 5 (#93)
This commit is contained in:
@@ -5,28 +5,15 @@
|
|||||||
* 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, { useEffect, useRef } from 'react';
|
import React, { useEffect, useRef } from 'react';
|
||||||
|
import { Box } from '@mui/system';
|
||||||
import Page from '../Page';
|
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) {
|
export default function PagedReader(props: IReaderProps) {
|
||||||
const {
|
const {
|
||||||
pages, settings, setCurPage, curPage, nextChapter, prevChapter,
|
pages, settings, setCurPage, curPage, nextChapter, prevChapter,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const classes = useStyles();
|
|
||||||
|
|
||||||
const selfRef = useRef<HTMLDivElement>(null);
|
const selfRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
function nextPage() {
|
function nextPage() {
|
||||||
@@ -97,7 +84,17 @@ export default function PagedReader(props: IReaderProps) {
|
|||||||
}, [selfRef, curPage, settings.readerType]);
|
}, [selfRef, curPage, settings.readerType]);
|
||||||
|
|
||||||
return (
|
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
|
<Page
|
||||||
key={curPage}
|
key={curPage}
|
||||||
index={curPage}
|
index={curPage}
|
||||||
@@ -106,6 +103,6 @@ export default function PagedReader(props: IReaderProps) {
|
|||||||
setCurPage={setCurPage}
|
setCurPage={setCurPage}
|
||||||
settings={settings}
|
settings={settings}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user