Create app namespace for all absolute requires of app modules. Move all packages under packages yarn workspace

This commit is contained in:
SleepWalker
2019-12-07 21:02:00 +02:00
parent d8d2df0702
commit f9d3bb4e20
404 changed files with 758 additions and 742 deletions

View File

@@ -0,0 +1,36 @@
import { RouteComponentProps } from 'react-router-dom';
import React from 'react';
import { withRouter } from 'react-router-dom';
import { restoreScroll } from './scroll';
class ScrollIntoView extends React.PureComponent<
RouteComponentProps & {
top?: boolean; // do not touch any DOM and simply scroll to top on location change
}
> {
componentDidMount() {
this.onPageUpdate();
}
componentDidUpdate(prevProps) {
if (this.props.location !== prevProps.location) {
this.onPageUpdate();
}
}
onPageUpdate() {
if (this.props.top) {
restoreScroll();
}
}
render() {
if (this.props.top) {
return null;
}
return <span ref={el => el && restoreScroll(el)} />;
}
}
export default withRouter(ScrollIntoView);