mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Migrating Vue components to React and stores refactoring (#585)
Signed-off-by: Roman <ixrock@gmail.com> Co-authored-by: Sebastian Malton <sebastian@malton.name> Co-authored-by: Sebastian Malton <smalton@mirantis.com> Co-authored-by: Lauri Nevala <lauri.nevala@gmail.com> Co-authored-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
297 files changed
+8186
-9103
No files matched your search
@@ -5,7 +5,7 @@ import { createPortal } from "react-dom";
|
||||
import { cssNames, noop } from "../../utils";
|
||||
import { Icon } from "../icon";
|
||||
import { Animate, AnimateName } from "../animate";
|
||||
import { browserHistory } from "../../navigation";
|
||||
import { history } from "../../navigation";
|
||||
import { themeStore } from "../../theme.store";
|
||||
|
||||
export interface DrawerProps {
|
||||
@@ -36,7 +36,7 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
private scrollElem: HTMLElement
|
||||
private scrollPos = new Map<string, number>();
|
||||
|
||||
private stopListenLocation = browserHistory.listen(() => {
|
||||
private stopListenLocation = history.listen(() => {
|
||||
this.restoreScrollPos();
|
||||
});
|
||||
|
||||
@@ -55,13 +55,13 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
|
||||
saveScrollPos = () => {
|
||||
if (!this.scrollElem) return;
|
||||
const key = browserHistory.location.key;
|
||||
const key = history.location.key;
|
||||
this.scrollPos.set(key, this.scrollElem.scrollTop);
|
||||
}
|
||||
|
||||
restoreScrollPos = () => {
|
||||
if (!this.scrollElem) return;
|
||||
const key = browserHistory.location.key;
|
||||
const key = history.location.key;
|
||||
this.scrollElem.scrollTop = this.scrollPos.get(key) || 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user