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

update page increment/decrement buttons

putting the `pageInput - 1` modifier in the `scrollToPage` method allows for more understandable button function ('back button' is `- 1` and 'forward button' is `+ 1`).
This commit is contained in:
Gazook89
2024-08-19 22:43:41 -05:00
parent 176977dd2a
commit 720e43e9d9
2 changed files with 7 additions and 12 deletions

View File

@@ -82,6 +82,7 @@ const BrewRenderer = (props)=>{
}, []);
const scrollToPage = (pageNumber) => {
pageNumber = pageNumber - 1;
const iframe = document.getElementById('BrewRenderer');
if (iframe && iframe.contentWindow) {
const brewRenderer =

View File

@@ -64,14 +64,12 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
<i className='fas fa-magnifying-glass-plus' />
</button>
</div>
<div className='tool'>
<button
className='previousPage'
onClick={()=>{
console.log(`page is ${state.currentPage}`);
onPageChange(state.currentPage - 2);
}}
disabled={state.currentPage <= 1}
onClick={()=>onPageChange(pageInput - 1)}
disabled={pageInput <= 1}
>
<i className='fas fa-arrow-left'></i>
</button>
@@ -92,13 +90,9 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
<div className='tool'>
<button
className='nextPage'
onClick={()=>{
console.log(
`page is ${state.currentPage} and i move to ${state.currentPage}`
);
onPageChange(state.currentPage);
}}
disabled={state.currentPage >= state.totalPages}
// onClick={()=>{setPageInput((pageInput)=>parseInt(pageInput) + 1)}}
onClick={()=>onPageChange(pageInput + 1)}
disabled={pageInput >= totalPages}
>
<i className='fas fa-arrow-right'></i>
</button>