mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-31 21:42:44 +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:
@@ -82,6 +82,7 @@ const BrewRenderer = (props)=>{
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const scrollToPage = (pageNumber) => {
|
const scrollToPage = (pageNumber) => {
|
||||||
|
pageNumber = pageNumber - 1;
|
||||||
const iframe = document.getElementById('BrewRenderer');
|
const iframe = document.getElementById('BrewRenderer');
|
||||||
if (iframe && iframe.contentWindow) {
|
if (iframe && iframe.contentWindow) {
|
||||||
const brewRenderer =
|
const brewRenderer =
|
||||||
|
|||||||
@@ -64,14 +64,12 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
|||||||
<i className='fas fa-magnifying-glass-plus' />
|
<i className='fas fa-magnifying-glass-plus' />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='tool'>
|
<div className='tool'>
|
||||||
<button
|
<button
|
||||||
className='previousPage'
|
className='previousPage'
|
||||||
onClick={()=>{
|
onClick={()=>onPageChange(pageInput - 1)}
|
||||||
console.log(`page is ${state.currentPage}`);
|
disabled={pageInput <= 1}
|
||||||
onPageChange(state.currentPage - 2);
|
|
||||||
}}
|
|
||||||
disabled={state.currentPage <= 1}
|
|
||||||
>
|
>
|
||||||
<i className='fas fa-arrow-left'></i>
|
<i className='fas fa-arrow-left'></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -92,13 +90,9 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
|||||||
<div className='tool'>
|
<div className='tool'>
|
||||||
<button
|
<button
|
||||||
className='nextPage'
|
className='nextPage'
|
||||||
onClick={()=>{
|
// onClick={()=>{setPageInput((pageInput)=>parseInt(pageInput) + 1)}}
|
||||||
console.log(
|
onClick={()=>onPageChange(pageInput + 1)}
|
||||||
`page is ${state.currentPage} and i move to ${state.currentPage}`
|
disabled={pageInput >= totalPages}
|
||||||
);
|
|
||||||
onPageChange(state.currentPage);
|
|
||||||
}}
|
|
||||||
disabled={state.currentPage >= state.totalPages}
|
|
||||||
>
|
>
|
||||||
<i className='fas fa-arrow-right'></i>
|
<i className='fas fa-arrow-right'></i>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user