0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-25 07:32:41 +00:00

rearrange state declarations for pages

totalPages shouldn't need to be in state, since this component won't be changing it.

renamed pageNumberInput to just pageInput.  Was just something that happened in the course of working on it.

currentPage doesn't need to have it's own state separate from pageInput, they should always be the same *value*.
This commit is contained in:
Gazook89
2024-08-19 22:32:02 -05:00
parent 2f42c3f857
commit 7fa9b3cdd2

View File

@@ -7,13 +7,9 @@ const MAX_ZOOM = 300;
const MIN_ZOOM = 10;
const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
const [state, setState] = useState({
currentPage : currentPage,
totalPages : totalPages,
pageNumberInput : currentPage,
});
const [zoomLevel, setZoomLevel] = useState(100);
const [pageInput, setPageInput] = useState(currentPage);
useEffect(()=>{
onZoomChange(zoomLevel);