Feature/update dependency mui to v5.x (#332)

* Update dependency "mui" to v5.x

Update to v5.13.3

Fixes issue of "SxProps" not being exported by "@mui/material"

* Update dependency "mui" to v5.x - Fix grid item size

Update to v5.13.3

Fixes issue of "SxProps" not being exported by "@mui/material"

* Update dependency "mui" to v5.x - Replace "ListItem" with "ListItemButton"

* Update dependency "mui" to v5.x - Fix tsc issue

* Update dependency "mui" to v5.x - Prevent reader white screen

Due to "initialChapter" being a function returning an object, it causes a re-render everytime due to it (the object) being used as a dependency.
This caused a white screen when skipping to the previous or next chapter
This commit is contained in:
schroda
2023-06-04 21:13:07 +02:00
committed by GitHub
parent 6911f60eb4
commit 1ce27ea939
11 changed files with 192 additions and 120 deletions

View File

@@ -7,14 +7,18 @@
*/
import React from 'react';
import ListItem, { ListItemProps } from '@mui/material/ListItem';
import { Link } from 'react-router-dom';
import { ListItemButton, ListItemButtonProps } from '@mui/material';
export default function ListItemLink(props: ListItemProps<Link, { directLink?: boolean }>) {
export default function ListItemLink(props: ListItemButtonProps<typeof Link, { directLink?: boolean }>) {
const { directLink, to } = props;
if (directLink) {
return <ListItem button component="a" href={to} {...props} />;
if (typeof to !== 'string') {
throw new Error('ListItemLink: "to" has to be a string in case it is a directLink');
}
return <ListItemButton component="a" href={to} {...props} />;
}
return <ListItem button component={Link} {...props} />;
return <ListItemButton component={Link} {...props} />;
}