mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-01-23 13:34:54 +03:00
feat: smooth scrolling on pagination
This commit is contained in:
parent
502f3b4aa7
commit
a499aae31f
@ -1,11 +1,13 @@
|
||||
@use "../../scss/globals.scss";
|
||||
|
||||
.catalogue {
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: calc(globals.$spacing-unit * 2);
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
scroll-behavior: smooth;
|
||||
|
||||
&__filters-container {
|
||||
width: 270px;
|
||||
|
@ -33,6 +33,7 @@ const PAGE_SIZE = 20;
|
||||
|
||||
export default function Catalogue() {
|
||||
const abortControllerRef = useRef<AbortController | null>(null);
|
||||
const cataloguePageRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { steamGenres, steamUserTags, steamDevelopers, steamPublishers } =
|
||||
useCatalogue();
|
||||
@ -214,7 +215,7 @@ export default function Catalogue() {
|
||||
]);
|
||||
|
||||
return (
|
||||
<div className="catalogue">
|
||||
<div className="catalogue" ref={cataloguePageRef}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
@ -303,7 +304,12 @@ export default function Catalogue() {
|
||||
<Pagination
|
||||
page={page}
|
||||
totalPages={Math.ceil(itemsCount / PAGE_SIZE)}
|
||||
onPageChange={(page) => dispatch(setPage(page))}
|
||||
onPageChange={(page) => {
|
||||
dispatch(setPage(page));
|
||||
if (cataloguePageRef.current) {
|
||||
cataloguePageRef.current.scrollTop = 0;
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user