mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add ability to hide KubeObjectMenu Edit and Remove buttons in extensions (#5107)
This commit is contained in:
1 parent
e532b90b72
commit
dbdde19222
51 files changed
+1245
-765
No files matched your search
@@ -5,8 +5,8 @@
|
||||
|
||||
import "./animate.scss";
|
||||
import React from "react";
|
||||
import { observable, reaction, makeObservable } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { observable, makeObservable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import { cssNames, noop } from "../../utils";
|
||||
|
||||
export type AnimateName = "opacity" | "slide-right" | "opacity-scale" | string;
|
||||
@@ -46,15 +46,24 @@ export class Animate extends React.Component<AnimateProps> {
|
||||
return React.Children.only(this.props.children) as React.ReactElement<React.HTMLAttributes<any>>;
|
||||
}
|
||||
|
||||
private toggle(enter: boolean) {
|
||||
if (enter) {
|
||||
this.enter();
|
||||
} else {
|
||||
this.leave();
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
disposeOnUnmount(this, [
|
||||
reaction(() => this.props.enter, enter => {
|
||||
if (enter) this.enter();
|
||||
else this.leave();
|
||||
}, {
|
||||
fireImmediately: true,
|
||||
}),
|
||||
]);
|
||||
this.toggle(this.props.enter);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps: Readonly<AnimateProps>): void {
|
||||
const { enter } = this.props;
|
||||
|
||||
if (prevProps.enter !== enter) {
|
||||
this.toggle(enter);
|
||||
}
|
||||
}
|
||||
|
||||
enter() {
|
||||
|
||||
Reference in new issue
Block a user