File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,11 @@ import { OverlayScrollContext } from "context/OverlayScrollContext";
44export const useScrollTop = ( ) => {
55 const osInstanceRef = useContext ( OverlayScrollContext ) ;
66
7- const scrollTop = ( ) => {
8- osInstanceRef ?. current ?. osInstance ( ) . elements ( ) . viewport . scroll ( { top : 0 } ) ;
7+ const scrollTop = ( smooth = false ) => {
8+ osInstanceRef ?. current
9+ ?. osInstance ( )
10+ . elements ( )
11+ . viewport . scroll ( { top : 0 , behavior : smooth ? "smooth" : "auto" } ) ;
912 } ;
1013
1114 return scrollTop ;
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import JurorCard from "../Home/TopJurors/JurorCard";
1515import { ListContainer , StyledLabel } from "../Home/TopJurors" ;
1616import Header from "../Home/TopJurors/Header" ;
1717import { decodeURIFilter } from "utils/uri" ;
18+ import { useScrollTop } from "hooks/useScrollTop" ;
1819
1920interface IDisplayJurors {
2021 totalLeaderboardJurors : number ;
@@ -28,6 +29,7 @@ const StyledPagination = styled(StandardPagination)`
2829
2930const DisplayJurors : React . FC < IDisplayJurors > = ( { totalLeaderboardJurors } ) => {
3031 const { page, order, filter } = useParams ( ) ;
32+ const scrollTop = useScrollTop ( ) ;
3133 const { id : searchValue } = decodeURIFilter ( filter ?? "all" ) ;
3234 const navigate = useNavigate ( ) ;
3335 const isDesktop = useIsDesktop ( ) ;
@@ -62,6 +64,7 @@ const DisplayJurors: React.FC<IDisplayJurors> = ({ totalLeaderboardJurors }) =>
6264 ) ;
6365
6466 const handlePageChange = ( newPage : number ) => {
67+ scrollTop ( true ) ;
6568 navigate ( `/jurors/${ newPage } /${ order } /${ filter } ` ) ;
6669 } ;
6770
You can’t perform that action at this time.
0 commit comments