mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 10:12:41 +00:00
Get basic function worked out
Adds `setBookMode()` which toggles a className on `.pages`. The `.book-mode` class sets display to grid, and the first child/page to start at the second slot of the book arrangement.
This commit is contained in:
@@ -12,6 +12,7 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
||||
|
||||
const [zoomLevel, setZoomLevel] = useState(100);
|
||||
const [pageInput, setPageInput] = useState(currentPage);
|
||||
const [arrangement, setArrangement] = useState('single');
|
||||
|
||||
useEffect(()=>{
|
||||
onZoomChange(zoomLevel);
|
||||
@@ -86,6 +87,13 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
||||
return deltaZoom;
|
||||
};
|
||||
|
||||
const setBookMode = ()=>{
|
||||
const iframe = document.getElementById('BrewRenderer');
|
||||
const pagesContainer = iframe.contentWindow.document.getElementsByClassName('pages')[0];
|
||||
pagesContainer.classList.toggle('book-mode');
|
||||
pagesContainer.firstChild.style.gridColumnStart = '2' ;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className='toolBar'>
|
||||
<div className='group'>
|
||||
@@ -137,6 +145,16 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages })=>{
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className='group'>
|
||||
<button
|
||||
id='book-mode'
|
||||
className='tool'
|
||||
onClick={()=>setBookMode()}
|
||||
>
|
||||
{arrangement}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className='group'>
|
||||
<button
|
||||
id='previous-page'
|
||||
|
||||
Reference in New Issue
Block a user