Scroll global
This commit is contained in:
@@ -3,7 +3,6 @@ import {getArtist, getArtistDiscs} from "../services/entity_service";
|
||||
import {CoverWithCaption} from './CoverArt';
|
||||
import {Paginate} from "./Paginate";
|
||||
import queryString from "query-string";
|
||||
import {useLocation} from 'react-router-dom';
|
||||
|
||||
|
||||
const Discs = (props) => {
|
||||
@@ -78,8 +77,6 @@ export const Artist = (props) => {
|
||||
}
|
||||
|
||||
export const ArtistView = (props) => {
|
||||
const {pathname} = useLocation();
|
||||
|
||||
const parsedParams = queryString.parse(props.location.search);
|
||||
|
||||
const [artist, setArtist] = useState(null);
|
||||
@@ -99,10 +96,6 @@ export const ArtistView = (props) => {
|
||||
}
|
||||
}, [mbid, page])
|
||||
|
||||
useEffect(() => {
|
||||
document.getElementById('root').scrollIntoView({behavior: 'smooth'});
|
||||
}, [pathname]);
|
||||
|
||||
const makeLink = (page) => {
|
||||
return `/artist/${mbid}?page=${page}`;
|
||||
}
|
||||
@@ -115,7 +108,6 @@ export const ArtistView = (props) => {
|
||||
setDiscs(result.discs);
|
||||
setDiscsPaginate(result.paginate);
|
||||
});
|
||||
document.getElementById('root').scrollIntoView({behavior: 'smooth'});
|
||||
props.history.push(makeLink(page));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export const Paginate = (props) => {
|
||||
|
||||
const handleClick = (page) => (evt) => {
|
||||
evt.preventDefault();
|
||||
document.getElementById('root').scrollIntoView({behavior: 'smooth'});
|
||||
if (currentPage !== page) gotoPage(page);
|
||||
}
|
||||
|
||||
|
||||
@@ -277,8 +277,6 @@ export const Search = (props) => {
|
||||
setWho(who);
|
||||
setPage(page);
|
||||
navigateTo(who, query, page);
|
||||
|
||||
window.scroll({left: 0, top: 0, behavior: 'smooth'});
|
||||
};
|
||||
|
||||
const content = _ => {
|
||||
|
||||
Reference in New Issue
Block a user