diff --git a/webUI/react/src/components/ReaderNavBar.tsx b/webUI/react/src/components/ReaderNavBar.tsx index 915efcb..def80dc 100644 --- a/webUI/react/src/components/ReaderNavBar.tsx +++ b/webUI/react/src/components/ReaderNavBar.tsx @@ -24,6 +24,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'; import Collapse from '@material-ui/core/Collapse'; import Button from '@material-ui/core/Button'; +import ClickAwayListener from '@material-ui/core/ClickAwayListener'; import DarkTheme from '../context/DarkTheme'; import NavBarContext from '../context/NavbarContext'; @@ -162,6 +163,7 @@ export default function ReaderNavBar(props: IProps) { } = props; const [drawerOpen, setDrawerOpen] = useState(false || settings.staticNav); + const [drawerVisible, setDrawerVisible] = useState(false || settings.staticNav); const [hideOpenButton, setHideOpenButton] = useState(false); const [prevScrollPos, setPrevScrollPos] = useState(0); const [settingsCollapseOpen, setSettingsCollapseOpen] = useState(false); @@ -180,14 +182,6 @@ export default function ReaderNavBar(props: IProps) { } }; - useEffect(() => { - window.addEventListener('scroll', handleScroll); - - return () => { - window.removeEventListener('scroll', handleScroll); - }; - }, [handleScroll]);// handleScroll changes on every render - useEffect(() => { window.addEventListener('scroll', handleScroll); @@ -200,27 +194,38 @@ export default function ReaderNavBar(props: IProps) { return () => { rootEl.classList.remove(classes.AppRootElment); mainContainer.classList.remove(classes.AppMainContainer); + window.removeEventListener('scroll', handleScroll); }; }, [handleScroll]);// handleScroll changes on every render return ( <> - -
-
- history.push(`/manga/${manga.id}`)} - > - - - - {title} - - {!settings.staticNav + (drawerVisible && setDrawerOpen(false))}> + setDrawerVisible(true)} + onExited={() => setDrawerVisible(false)} + > +
+
+ history.push(`/manga/${manga.id}`)} + > + + + + {title} + + {!settings.staticNav && ( ) } -
- - - - setSettingsCollapseOpen(!settingsCollapseOpen)} - > - {settingsCollapseOpen && } - {!settingsCollapseOpen && } - - - - - - - - - setSettingValue('staticNav', e.target.checked)} - /> - - - - - - setSettingValue('showPageNumber', e.target.checked)} - /> - - - - -
-
- - Currently on page - {' '} - {curPage + 1} - {' '} - of - {' '} - {chapter.pageCount} - -
- {chapter.chapterIndex > 1 +
+ + + + setSettingsCollapseOpen(!settingsCollapseOpen)} + > + {settingsCollapseOpen && } + {!settingsCollapseOpen && } + + + + + + + + + setSettingValue('staticNav', e.target.checked)} + /> + + + + + + setSettingValue('showPageNumber', e.target.checked)} + /> + + + + +
+
+ + Currently on page + {' '} + {curPage + 1} + {' '} + of + {' '} + {chapter.pageCount} + +
+ {chapter.chapterIndex > 1 && ( )} - {chapter.chapterIndex < chapter.chapterCount + {chapter.chapterIndex < chapter.chapterCount && ( )} +
- -
+ +