migrate some components to Mui5 new styling system (#72)

* - Changed the value in Manga from 960 to 900( md breakpooint)
- The CicularLoader in About  and Reader screens is now centered to the whole screen
- Changed relative imports in About screen to absolute imports
- removed changed styles from Browse Screen, PageNumber

* Migrated Source Card, Extension Card and LoadingPlaceHolder to MUI system

* Migrated CategorySelect and LandSelect to using the sx prop

* migrated ReaderNavbar to mui 5

* - Removed Unused Styles from Page
- Migrated DoublePage, doublePagedPager, PagedPager, Vertical Pager and Horizontal Pager.

* Replaced style prop with sx prop

* removed useStyles completely from the project except for the Manga Screen

* added a comment

* Fixed the Source Card Buttons padding

* Removed the trailing backspace

Co-authored-by: Sascha Hahne <ntbm@users.noreply.github.com>

Co-authored-by: Sascha Hahne <ntbm@users.noreply.github.com>
This commit is contained in:
abhijeetChawla
2021-11-14 15:51:08 +05:30
committed by GitHub
parent 93c4ce3450
commit 72ef61e286
28 changed files with 341 additions and 501 deletions

View File

@@ -10,6 +10,7 @@ import React from 'react';
import Typography from '@mui/material/Typography';
import { useTheme } from '@mui/material/styles';
import { useMediaQuery } from '@mui/material';
import { Box } from '@mui/system';
const ERROR_FACES = [
'(・o・;)',
@@ -35,7 +36,7 @@ export default function EmptyView({ message, messageExtra }: IProps) {
const isMobileWidth = useMediaQuery(theme.breakpoints.down('sm'));
return (
<div style={{
<Box sx={{
position: 'absolute',
left: `calc(50% + ${isMobileWidth ? '0px' : theme.spacing(8 / 2)})`,
top: '50%',
@@ -50,7 +51,7 @@ export default function EmptyView({ message, messageExtra }: IProps) {
{message}
</Typography>
{messageExtra}
</div>
</Box>
);
}

View File

@@ -8,16 +8,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import React from 'react';
import makeStyles from '@mui/styles/makeStyles';
import CircularProgress from '@mui/material/CircularProgress';
const useStyles = makeStyles({
loading: {
margin: '10px auto',
display: 'flex',
justifyContent: 'center',
},
});
import { Box } from '@mui/system';
interface IProps {
shouldRender?: boolean | (() => boolean)
@@ -30,7 +22,6 @@ export default function LoadingPlaceholder(props: IProps) {
const {
children, shouldRender, component, componentProps,
} = props;
const classes = useStyles();
let condition = true;
if (shouldRender !== undefined) {
@@ -52,8 +43,13 @@ export default function LoadingPlaceholder(props: IProps) {
}
return (
<div className={classes.loading}>
<Box sx={{
margin: '10px auto',
display: 'flex',
justifyContent: 'center',
}}
>
<CircularProgress thickness={5} />
</div>
</Box>
);
}

View File

@@ -17,9 +17,7 @@ interface IProps {
imgRef?: React.RefObject<HTMLImageElement>
spinnerClassName?: string
spinnerStyle?: SxProps<Theme>
imgClassName?: string
imgStyle?: CSSProperties
onImageLoad?: () => void
@@ -27,7 +25,7 @@ interface IProps {
export default function SpinnerImage(props: IProps) {
const {
src, alt, onImageLoad, imgRef, spinnerClassName, imgClassName, spinnerStyle, imgStyle,
src, alt, onImageLoad, imgRef, spinnerStyle, imgStyle,
} = props;
const [imageSrc, setImagsrc] = useState<string>('');
@@ -53,19 +51,18 @@ export default function SpinnerImage(props: IProps) {
if (imageSrc.length === 0) {
return (
<Box className={spinnerClassName} sx={spinnerStyle}>
<Box sx={spinnerStyle}>
<CircularProgress thickness={5} />
</Box>
);
}
if (imageSrc === 'Not Found') {
return <Box className={spinnerClassName} sx={spinnerStyle} />;
return <Box sx={spinnerStyle} />;
}
return (
<img
className={imgClassName}
style={imgStyle}
ref={imgRef}
src={imageSrc}
@@ -75,8 +72,6 @@ export default function SpinnerImage(props: IProps) {
}
SpinnerImage.defaultProps = {
spinnerClassName: '',
imgClassName: '',
spinnerStyle: {},
imgStyle: {},
onImageLoad: () => {},