File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
frontend/src/components/pages/search Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 4343 height : 40px ;
4444}
4545
46+ .search-page-load-more-button {
47+ background-color : var (--button-primary-color );
48+ color : var (--background-color-dark-heavy );
49+ --bs-btn-hover-bg : var (--accent-bright );
50+ border : 1px solid var (--additional-gray );
51+ border-radius : 10px ;
52+ height : 40px ;
53+ }
54+
4655.search-page-reset-button {
4756 transition : 0.4s ;
4857 background-color : var (--button-secondary-color );
Original file line number Diff line number Diff line change @@ -104,6 +104,16 @@ const SearchPage = ({ apiPrefix }) => {
104104 }
105105 } ;
106106
107+ const handleLoadMore = ( ) => {
108+ const currentScrollY = window . scrollY ;
109+
110+ setCurrentPage ( ( prevPage ) => prevPage + 1 ) ;
111+
112+ setTimeout ( ( ) => {
113+ window . scrollTo ( 0 , currentScrollY ) ;
114+ } , 100 ) ;
115+ } ;
116+
107117 const applyInputFilters = ( ) => {
108118 setFilters ( ( prevFilters ) => ( {
109119 ...prevFilters ,
@@ -485,9 +495,9 @@ const SearchPage = ({ apiPrefix }) => {
485495 { hasMore && (
486496 < div className = "text-center" >
487497 < button
488- onClick = { ( ) => setCurrentPage ( ( prev ) => prev + 1 ) }
489- className = "btn btn-primary my-3"
490- disabled = { isLoading }
498+ onClick = { handleLoadMore }
499+ disabled = { isLoading || ! hasMore }
500+ className = "btn search-page-load-more-button my-3"
491501 >
492502 { isLoading ? 'Loading...' : 'Load More' }
493503 </ button >
You can’t perform that action at this time.
0 commit comments