@@ -210,51 +210,22 @@ function DatabasePageControls({position, offset, maxRows, rowCount, setOffset})
210210 bRadius = "7px 7px 0 0" ;
211211 }
212212
213+ // Hide or show the page controls depending on the current position while maintaining their width
214+ const disabledUp = offset > 0 ? null : "disabled" ;
215+ const disabledDown = ( offset + maxRows ) < rowCount ? null : "disabled" ;
216+
213217 return (
214- < div className = "row" >
215- < div className = "col-md-12" >
216- < div style = { { maxWidth : "100%" , overflow : "auto" , border : "1px solid #DDD" , borderRadius : bRadius } } >
217- < table className = "table table-responsive" style = { { margin : 0 } } >
218- < thead >
219- < tr >
220- < th style = { { textAlign : "center" , padding : 0 , borderBottom : "1px" } } >
221- { offset > 0 ? ( < >
222- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
223- < a href = "#/" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( 0 ) } data-cy = "firstpgbtn" > < i className = 'fa fa-fast-backward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i > </ a >
224- </ span >
225- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
226- < a href = "#/" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset - maxRows ) } data-cy = "pgupbtn" > < i className = 'fa fa-backward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 2px 2px 0" } } > </ i > </ a >
227- </ span >
228- </ > ) : ( < >
229- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
230- < i className = 'fa fa-fast-backward' style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i >
231- </ span >
232- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
233- < i className = 'fa fa-backward' style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 2px 2px 0" } } > </ i >
234- </ span >
235- </ > ) }
236- { offset + maxRows < rowCount ? ( < >
237- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
238- < a href = "#/" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( offset + maxRows ) } data-cy = "pgdnbtn" > < i className = 'fa fa-forward' style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 0 2px 2px" } } > </ i > </ a >
239- </ span >
240- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
241- < a href = "#/" style = { { color : "black" , textDecoration : "none" } } onClick = { ( ) => setOffset ( rowCount - maxRows ) } data-cy = "lastpgbtn" > < i className = "fa fa-fast-forward" style = { { border : "1px solid #aaa" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i > </ a >
242- </ span >
243- </ > ) : ( < >
244- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
245- < i className = 'fa fa-forward' style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px 0 2px 2px" } } > </ i >
246- </ span >
247- < span style = { { fontSize : "x-large" , verticalAlign : "middle" , marginBottom : "10px" } } >
248- < i className = "fa fa-fast-forward" style = { { color : "white" , background : "white" , border : "1px solid white" , borderRadius : "3px" , marginTop : "4px" , padding : "2px" } } > </ i >
249- </ span >
250- </ > ) }
251- < span style = { { verticalAlign : "middle" } } > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
252- </ th >
253- </ tr >
254- </ thead >
255- </ table >
218+ < div className = "text-center" style = { { padding : "2px" , border : "1px solid #DDD" , borderRadius : bRadius } } >
219+ < div className = "btn-group" role = "group" >
220+ < button type = "button" className = "btn btn-default" disabled = { disabledUp } onClick = { ( ) => setOffset ( 0 ) } data-cy = "firstpgbtn" > < i className = "fa fa-fast-backward" > </ i > </ button >
221+ < button type = "button" className = "btn btn-default" disabled = { disabledUp } onClick = { ( ) => setOffset ( offset - maxRows ) } data-cy = "pgupbtn" > < i className = "fa fa-backward" > </ i > </ button >
256222 </ div >
257- </ div >
223+
224+ < div className = "btn-group" role = "group" >
225+ < button type = "button" className = "btn btn-default" disabled = { disabledDown } onClick = { ( ) => setOffset ( offset + maxRows ) } data-cy = "pgdnbtn" > < i className = "fa fa-forward" > </ i > </ button >
226+ < button type = "button" className = "btn btn-default" disabled = { disabledDown } onClick = { ( ) => setOffset ( rowCount - maxRows ) } data-cy = "lastpgbtn" > < i className = "fa fa-fast-forward" > </ i > </ button >
227+ </ div >
228+ < span > { totalRowCountText ( offset , maxRows , rowCount ) } </ span >
258229 </ div >
259230 ) ;
260231}
0 commit comments