mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Lint: no-unused-expressions (error) (#4197)
This commit is contained in:
1 parent
c6dab62e99
commit
e74f17e8ce
9 files changed
+79
-50
No files matched your search
@@ -90,6 +90,10 @@ export class Menu extends React.Component<MenuProps, State> {
|
||||
return !!this.props.isOpen;
|
||||
}
|
||||
|
||||
get isClosed() {
|
||||
return !this.isOpen;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (!this.props.usePortal) {
|
||||
const parent = this.elem.parentElement;
|
||||
@@ -202,19 +206,32 @@ export class Menu extends React.Component<MenuProps, State> {
|
||||
};
|
||||
|
||||
open() {
|
||||
if (this.isOpen) return;
|
||||
if (this.isOpen) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.open();
|
||||
this.refreshPosition();
|
||||
if (this.props.autoFocus) this.focusNextItem();
|
||||
|
||||
if (this.props.autoFocus) {
|
||||
this.focusNextItem();
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
if (!this.isOpen) return;
|
||||
if (this.isClosed) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.props.close();
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.isOpen ? this.close() : this.open();
|
||||
if (this.isOpen) {
|
||||
this.close();
|
||||
} else {
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
|
||||
onKeyDown(evt: KeyboardEvent) {
|
||||
|
||||
Reference in new issue
Block a user