0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 12:12:42 +00:00

change view mode toggles to indiv buttons

Rather than a single button with three states, it is three buttons.  Went with buttons with `role='radio'` rather than true radios mostly because that is what Radix does.
This commit is contained in:
Gazook89
2024-10-11 22:06:41 -05:00
parent 6cabdc0a67
commit 395f2d16fa
2 changed files with 33 additions and 12 deletions

View File

@@ -88,9 +88,9 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages, onStyleC
return deltaZoom; return deltaZoom;
}; };
const setBookMode = ()=>{ const setBookMode = (view)=>{
const nextMode = modes[(modes.indexOf(arrangement) + 1) % modes.length]; // const nextMode = modes[(modes.indexOf(arrangement) + 1) % modes.length];
setArrangement(nextMode); setArrangement(view);
}; };
return ( return (
@@ -148,13 +148,24 @@ const ToolBar = ({ onZoomChange, currentPage, onPageChange, totalPages, onStyleC
{/*v=====----------------------< Page Controls >---------------------=====v*/} {/*v=====----------------------< Page Controls >---------------------=====v*/}
<div className='group'> <div className='group'>
<button <div className='radio-group' role='group'>
id='book-mode' <button role='radio'
className='tool' id='single-view'
onClick={()=>setBookMode()} className={`tool${arrangement === 'single' && ' active'}`}
> onClick={()=>setBookMode('single')}
{arrangement} ><i className='fac single-view-alt' /></button>
</button> <button role='radio'
id='facing-view'
className={`tool${arrangement === 'facing' && ' active'}`}
onClick={()=>setBookMode('facing')}
><i className='fac facing-view-alt' /></button>
<button role='radio'
id='flow-view'
className={`tool${arrangement === 'flow' && ' active'}`}
onClick={()=>setBookMode('flow')}
><i className='fac flow-view-alt' /></button>
</div>
<AnchoredBox id='view-mode-options' className='tool' title='Options'> <AnchoredBox id='view-mode-options' className='tool' title='Options'>
<label title='Modify the horizontal space between pages.'>Column gap<input type='range' min={0} max={200} className='range-input' onChange={(evt)=>onStyleChange({ columnGap: `${evt.target.value}px` })} /></label> <label title='Modify the horizontal space between pages.'>Column gap<input type='range' min={0} max={200} className='range-input' onChange={(evt)=>onStyleChange({ columnGap: `${evt.target.value}px` })} /></label>
<label title='Modify the vertical space between rows of pages.'>Row gap<input type='range' min={0} max={200} className='range-input' onChange={(evt)=>onStyleChange({ rowGap: `${evt.target.value}px` })} /></label> <label title='Modify the vertical space between rows of pages.'>Row gap<input type='range' min={0} max={200} className='range-input' onChange={(evt)=>onStyleChange({ rowGap: `${evt.target.value}px` })} /></label>

View File

@@ -34,6 +34,10 @@
align-items : center; align-items : center;
} }
.active {
background-color: #444;
}
.anchored-box { .anchored-box {
color: #CCCCCC; color: #CCCCCC;
input[type='number']{ input[type='number']{
@@ -41,6 +45,12 @@
} }
} }
.radio-group:has(button[role='radio']){
display: flex;
border: 1px solid #333;
height: 100%;
}
input { input {
position : relative; position : relative;
height : 1.5em; height : 1.5em;
@@ -90,7 +100,7 @@
} }
button { button {
box-sizing : content-box; box-sizing : border-box;
display : flex; display : flex;
align-items : center; align-items : center;
justify-content : center; justify-content : center;
@@ -107,7 +117,7 @@
} }
&:hover { background-color : #444444; } &:hover { background-color : #444444; }
&:focus { outline : 1px solid #D3D3D3; } &:focus { border : 1px solid #D3D3D3;outline: none;}
&:disabled { &:disabled {
color : #777777; color : #777777;
background-color : unset !important; background-color : unset !important;